summaryrefslogtreecommitdiff
authortille <tille>2002-04-29 22:45:35 (UTC)
committer tille <tille>2002-04-29 22:45:35 (UTC)
commitb794af4c50efffe239c94e5a015e90565ff991c3 (patch) (unidiff)
treedd4e20851eba8052a07396b57388f9216f85ae7f
parente4d0908ec054b71a9b97e9c35efbd5a697d0b58d (diff)
downloadopie-b794af4c50efffe239c94e5a015e90565ff991c3.zip
opie-b794af4c50efffe239c94e5a015e90565ff991c3.tar.gz
opie-b794af4c50efffe239c94e5a015e90565ff991c3.tar.bz2
removes links again
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO4
-rw-r--r--noncore/unsupported/oipkg/debug.h2
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp159
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h12
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro2
-rw-r--r--noncore/unsupported/oipkg/package.cpp47
-rw-r--r--noncore/unsupported/oipkg/package.h4
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp33
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.h1
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp20
-rw-r--r--noncore/unsupported/oipkg/packagelistview.h2
-rw-r--r--noncore/unsupported/oipkg/pkdesc.ui96
-rw-r--r--noncore/unsupported/oipkg/pksettings.cpp45
-rw-r--r--noncore/unsupported/oipkg/pksettings.h4
-rw-r--r--noncore/unsupported/oipkg/pksettingsbase.ui23
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp276
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h28
-rw-r--r--noncore/unsupported/oipkg/settings.cpp5
-rw-r--r--noncore/unsupported/oipkg/settings.h32
-rw-r--r--noncore/unsupported/oipkg/utils.cpp27
-rw-r--r--noncore/unsupported/oipkg/utils.h18
21 files changed, 499 insertions, 341 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO
index 3fc84e5..790766c 100644
--- a/noncore/unsupported/oipkg/TODO
+++ b/noncore/unsupported/oipkg/TODO
@@ -1,11 +1,9 @@
1* setDocument function
2* Settings Class 1* Settings Class
3* tr() ;) 2* tr() ;)
4* Dialog to display ipkg output live 3* Dialog to display ipkg output live
5* parse "to install" and "to remove" from status 4* parse "to install" and "to remove" from status
6* install local file 5* install local file dialog
7* qcop 6* qcop
8* error handling 7* error handling
9* manage links 8* manage links
10* dependency checking 9* dependency checking
11* 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 973d96c..206dea5 100644
--- a/noncore/unsupported/oipkg/debug.h
+++ b/noncore/unsupported/oipkg/debug.h
@@ -15,7 +15,7 @@ if ( debugLevel < 3 ) \
15 if ( I <= debugLevel ) qDebug(S);\ 15 if ( I <= debugLevel ) qDebug(S);\
16}else{\ 16}else{\
17 if ( I <= debugLevel ) \ 17 if ( I <= debugLevel ) \
18 qDebug("# %s \t\t(Level: %i)\n",QString(S).latin1(),I);\ 18 qDebug("#%s:%i: %s \t\t(Level: %i)",__FILE__,__LINE__,QString(S).latin1(),I);\
19} 19}
20 20
21#endif \ No newline at end of file 21#endif \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index c95f482..ca1e5e8 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -6,6 +6,7 @@
6#include <qpe/qpemenubar.h> 6#include <qpe/qpemenubar.h>
7#include <qpe/qpemessagebox.h> 7#include <qpe/qpemessagebox.h>
8#include <qpe/resource.h> 8#include <qpe/resource.h>
9#include <qpe/config.h>
9#include <qpe/qpetoolbar.h> 10#include <qpe/qpetoolbar.h>
10#include <qpe/qcopenvelope_qws.h> 11#include <qpe/qcopenvelope_qws.h>
11#include <qaction.h> 12#include <qaction.h>
@@ -17,6 +18,7 @@
17#include <qfile.h> 18#include <qfile.h>
18#include <qlistview.h> 19#include <qlistview.h>
19#include <qtextview.h> 20#include <qtextview.h>
21#include <qcheckbox.h>
20#include <qlineedit.h> 22#include <qlineedit.h>
21#include <qtabwidget.h> 23#include <qtabwidget.h>
22#include <qcombobox.h> 24#include <qcombobox.h>
@@ -24,39 +26,34 @@
24#include <qlayout.h> 26#include <qlayout.h>
25 27
26#include "pksettingsbase.h" 28#include "pksettingsbase.h"
29#include "utils.h"
27#include "packagelistitem.h" 30#include "packagelistitem.h"
28 31
29 32
30MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : 33MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
31 QMainWindow( parent, name, f ) 34 QMainWindow( parent, name, f )
32 { 35 {
36 setCaption( tr("Package Manager") );
33 settings = new PackageManagerSettings(this,0,TRUE); 37 settings = new PackageManagerSettings(this,0,TRUE);
34 listViewPackages = new PackageListView( this,"listViewPackages",settings ); 38 listViewPackages = new PackageListView( this,"listViewPackages",settings );
35 ipkg = new PmIpkg( settings, this );
36
37 setCentralWidget( listViewPackages ); 39 setCentralWidget( listViewPackages );
38 setCaption( tr("Package Manager") );
39 40
40 //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); 41 //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton);
41 wait = new QMessageBox(this); 42 //wait = new QMessageBox(this);
42 wait->setText(tr("Please wait")); 43 // wait->setText(tr("Please wait"));
43
44 channel = new QCopChannel( "QPE/Application/oipkg", this );
45 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
46 this, SLOT(receive(const QCString&, const QByteArray&)) );
47
48 makeMenu();
49
50 connect( section, SIGNAL( activated(int) ),
51 this, SLOT( sectionChanged() ) );
52 connect( subsection, SIGNAL(activated(int) ),
53 this, SLOT( subSectionChanged() ) );
54
55 ipkg = new PmIpkg( settings, this ); 44 ipkg = new PmIpkg( settings, this );
56 packageList.setSettings( settings ); 45 packageList.setSettings( settings );
57 getList(); 46 packageList.update();
58 setSections(); 47 makeMenu();
59 setSubSections(); 48 makeChannel();
49 //opie is hardcoded default ;)
50 for (int i=0;i<section->count();i++)
51 if (section->text(i)=="opie")
52 section->setCurrentItem(i);
53 sectionChanged();
54
55 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
56 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
60 displayList(); 57 displayList();
61} 58}
62 59
@@ -100,32 +97,28 @@ void MainWindow::makeMenu()
100 updateAction->addTo( toolBar ); 97 updateAction->addTo( toolBar );
101 updateAction->addTo( srvMenu ); 98 updateAction->addTo( srvMenu );
102 99
103// would we use for find 100// could we use for find
104// detailsAction = new QAction( tr( "Details" ), 101// detailsAction = new QAction( tr( "Find" ),
105 // Resource::loadIconSet( "find" ), 102 // Resource::loadIconSet( "find" ),
106 // QString::null, 0, this, 0 ); 103 // QString::null, 0, this, 0 );
107// connect( detailsAction, SIGNAL( activated() ), 104// connect( detailsAction, SIGNAL( activated() ),
108// this , SLOT( showDetails() ) ); 105// this , SLOT( showFind() ) );
109// detailsAction->addTo( toolBar ); 106// detailsAction->addTo( toolBar );
110// detailsAction->addTo( srvMenu );
111 107
112 QAction *cfgact; 108 QAction *cfgact;
113 109
114 cfgact = new QAction( tr( "Setups" ), 110 cfgact = new QAction( tr( "Setups" ),
115 // Resource::loadIconSet( "" ),
116 QString::null, 0, this, 0 ); 111 QString::null, 0, this, 0 );
117 connect( cfgact, SIGNAL( activated() ), 112 connect( cfgact, SIGNAL( activated() ),
118 SLOT( showSettings() ) ); 113 SLOT( showSettings() ) );
119 cfgact->addTo( cfgMenu ); 114 cfgact->addTo( cfgMenu );
120 115
121 cfgact = new QAction( tr( "Servers" ), 116 cfgact = new QAction( tr( "Servers" ),
122 // Resource::loadIconSet( "" ),
123 QString::null, 0, this, 0 ); 117 QString::null, 0, this, 0 );
124 connect( cfgact, SIGNAL( activated() ), 118 connect( cfgact, SIGNAL( activated() ),
125 SLOT( showSettingsSrv() ) ); 119 SLOT( showSettingsSrv() ) );
126 cfgact->addTo( cfgMenu ); 120 cfgact->addTo( cfgMenu );
127 cfgact = new QAction( tr( "Destinations" ), 121 cfgact = new QAction( tr( "Destinations" ),
128 //Resource::loadIconSet( "" ),
129 QString::null, 0, this, 0 ); 122 QString::null, 0, this, 0 );
130 connect( cfgact, SIGNAL( activated() ), 123 connect( cfgact, SIGNAL( activated() ),
131 SLOT( showSettingsDst() ) ); 124 SLOT( showSettingsDst() ) );
@@ -140,19 +133,19 @@ void MainWindow::makeMenu()
140 label->setBackgroundColor( sectionBar->backgroundColor() ); 133 label->setBackgroundColor( sectionBar->backgroundColor() );
141 sectionBar->setStretchableWidget( label ); 134 sectionBar->setStretchableWidget( label );
142 section = new QComboBox( false, sectionBar ); 135 section = new QComboBox( false, sectionBar );
143// section->setBackgroundMode( PaletteBackground );
144 label = new QLabel( " / ", sectionBar ); 136 label = new QLabel( " / ", sectionBar );
145 label->setBackgroundColor( sectionBar->backgroundColor() ); 137 label->setBackgroundColor( sectionBar->backgroundColor() );
146 subsection = new QComboBox( false, sectionBar ); 138 subsection = new QComboBox( false, sectionBar );
147
148 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 139 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
149 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 140 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
150 a->addTo( sectionBar ); 141 a->addTo( sectionBar );
151 142
143 setSections();
144 setSubSections();
145
152 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 146 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
153 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 147 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
154 sectionAction->setToggleAction( true ); 148 sectionAction->setToggleAction( true );
155 sectionAction->setOn( true );
156 sectionAction->addTo( viewMenu ); 149 sectionAction->addTo( viewMenu );
157 150
158 findBar = new QPEToolBar(this); 151 findBar = new QPEToolBar(this);
@@ -165,30 +158,65 @@ void MainWindow::makeMenu()
165 connect( findEdit, SIGNAL( textChanged( const QString & ) ), 158 connect( findEdit, SIGNAL( textChanged( const QString & ) ),
166 this, SLOT( displayList() ) ); 159 this, SLOT( displayList() ) );
167 160
161 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
162 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
163 a->addTo( findBar );
168 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 164 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
169 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 165 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
170 a->addTo( findBar ); 166 a->addTo( findBar );
171 findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); 167 findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 );
172 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 168 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
173 findAction->setToggleAction( true ); 169 findAction->setToggleAction( true );
174 findAction->setOn( true );
175 findAction->addTo( viewMenu ); 170 findAction->addTo( viewMenu );
176 171
177 #ifdef NEW 172 destBar = new QPEToolBar(this);
173 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
174 label = new QLabel( tr("Destination: "), destBar );
175 label->setBackgroundColor( destBar->backgroundColor() );
176 destBar->setHorizontalStretchable( TRUE );
177 destination = new QComboBox( false, destBar );
178 destination->insertStringList( settings->getDestinationNames() );
179 setComboName(destination,settings->getDestinationName());
180// connect( destination, SIGNAL(activated(int)),
181 // SLOT(activeDestinationChange(int)) );
182 spacer = new QLabel( " ", destBar );
183 spacer->setBackgroundColor( destBar->backgroundColor() );
184 CheckBoxLink = new QCheckBox( tr("Link"), destBar);
185 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() );
186 CheckBoxLink->setChecked( settings->createLinks() );
187// connect( CheckBoxLink, SIGNAL(toggled(bool)),
188 // settings, SLOT(linkEnabled(bool)) );
189 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
190 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
191 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
192 connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
193 a->addTo( destBar );
194 destBar->setStretchableWidget( CheckBoxLink );
195 destAction->setToggleAction( true );
196 // destAction->addTo( viewMenu );
197
198 // configure the menus
178 Config cfg( "oipkg", Config::User ); 199 Config cfg( "oipkg", Config::User );
179 cfg.setGroup( "Setting_" + QString::number( setting ) ); 200 cfg.setGroup( "gui" );
180 CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); 201
181 findShow(bool b) 202 findShow( cfg.readBoolEntry( "findBar", true ) );
182 sectionShow(bool b) 203 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
183 #endif 204 destShow( cfg.readBoolEntry( "destBar", false ) );
184} 205}
185 206
186MainWindow::~MainWindow() 207MainWindow::~MainWindow()
187{ 208{
209 Config cfg( "oipkg", Config::User );
210 cfg.setGroup( "gui" );
211 cfg.writeEntry( "findBar", !findBar->isHidden() );
212 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
213 cfg.writeEntry( "destBar", !destBar->isHidden() );
214
188} 215}
189 216
190void MainWindow::runIpkg() 217void MainWindow::runIpkg()
191{ 218{
219 packageList.allPackages();
192 ipkg->commit( packageList ); 220 ipkg->commit( packageList );
193 // ##### If we looked in the list of files, we could send out accurate 221 // ##### If we looked in the list of files, we could send out accurate
194 // ##### messages. But we don't bother yet, and just do an "all". 222 // ##### messages. But we don't bother yet, and just do an "all".
@@ -200,38 +228,29 @@ void MainWindow::runIpkg()
200 228
201void MainWindow::updateList() 229void MainWindow::updateList()
202{ 230{
203 wait->show(); 231 //wait->show();
204 QTimer *t = new QTimer( this ); 232 QTimer *t = new QTimer( this );
205 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); 233 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
206 t->start( 0, false ); 234 t->start( 0, false );
207 packageList.clear(); 235 packageList.clear();
208 ipkg->update(); 236 ipkg->update();
209 getList();
210 t->stop();
211 wait->hide();
212
213}
214
215void MainWindow::getList()
216{
217 wait->show();
218 packageList.update(); 237 packageList.update();
219 displayList(); 238 t->stop();
220 wait->hide(); 239 // wait->hide();
221} 240}
222 241
223void MainWindow::filterList() 242void MainWindow::filterList()
224{ 243{
225 wait->show(); 244 //wait->show();
226 QString f = ""; 245 QString f = "";
227 if ( findAction->isOn() ) f = findEdit->text(); 246 if ( findAction->isOn() ) f = findEdit->text();
228 packageList.filterPackages( f ); 247 packageList.filterPackages( f );
229 wait->hide(); 248 //wait->hide();
230} 249}
231 250
232void MainWindow::displayList() 251void MainWindow::displayList()
233{ 252{
234 wait->hide(); 253 //wait->hide();
235 filterList(); 254 filterList();
236 listViewPackages->clear(); 255 listViewPackages->clear();
237 Package *pack = packageList.first(); 256 Package *pack = packageList.first();
@@ -326,6 +345,18 @@ void MainWindow::findClose()
326 findAction->setOn( false ); 345 findAction->setOn( false );
327} 346}
328 347
348void MainWindow::destShow(bool b)
349{
350 if (b) destBar->show();
351 else destBar->hide();
352 destAction->setOn( b );
353}
354
355void MainWindow::destClose()
356{
357 destAction->setOn( false );
358}
359
329void MainWindow::rotateUpdateIcon() 360void MainWindow::rotateUpdateIcon()
330{ 361{
331 pvDebug(2, "MainWindow::rotateUpdateIcon"); 362 pvDebug(2, "MainWindow::rotateUpdateIcon");
@@ -361,11 +392,31 @@ void MainWindow::installFile(const QString &fileName)
361 displayList(); 392 displayList();
362} 393}
363 394
395void MainWindow::makeChannel()
396 {
397 channel = new QCopChannel( "QPE/Application/oipkg", this );
398 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
399 this, SLOT(receive(const QCString&, const QByteArray&)) );
400}
401
402
403
364void MainWindow::receive(const QCString &msg, const QByteArray &arg) 404void MainWindow::receive(const QCString &msg, const QByteArray &arg)
365{ 405{
366 pvDebug(3, "QCop "+msg); 406 pvDebug(3, "QCop "+msg+" "+QCString(arg));
367 if ( msg == "installFile(QString)" ) 407 if ( msg == "installFile(QString)" )
368 { 408 {
369 installFile( QString(arg) ); 409 ipkg->installFile( QString(arg) );
410 }else if( msg == "removeFile(QString)" )
411 {
412 ipkg->removeFile( QString(arg) );
413 }else if( msg == "createLinks(QString)" )
414 {
415 ipkg->createLinks( QString(arg) );
416 }else if( msg == "removeLinks(QString)" )
417 {
418 ipkg->removeLinks( QString(arg) );
419 }else{
420 pvDebug(2,"Huh what do ya want")
370 } 421 }
371} \ No newline at end of file 422} \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index a713d00..7615b09 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -17,6 +17,7 @@ class QLineEdit;
17class PackageListItem; 17class PackageListItem;
18class QCopChannel; 18class QCopChannel;
19class QMessageBox; 19class QMessageBox;
20class QCheckBox;
20 21
21class MainWindow : public QMainWindow 22class MainWindow : public QMainWindow
22{ 23{
@@ -26,12 +27,12 @@ class MainWindow : public QMainWindow
26public: 27public:
27 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 28 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
28 ~MainWindow(); 29 ~MainWindow();
30 void makeChannel();
29 31
30 QCopChannel *channel; 32 QCopChannel *channel;
31 33
32protected slots: 34protected slots:
33 void runIpkg(); 35 void runIpkg();
34 void getList();
35 void updateList(); 36 void updateList();
36 void displayList(); 37 void displayList();
37 void subSectionChanged(); 38 void subSectionChanged();
@@ -45,6 +46,8 @@ public slots:
45 void sectionShow(bool); 46 void sectionShow(bool);
46 void findClose(); 47 void findClose();
47 void findShow(bool); 48 void findShow(bool);
49 void destClose();
50 void destShow(bool);
48 void filterList(); 51 void filterList();
49 void receive (const QCString &, const QByteArray &); 52 void receive (const QCString &, const QByteArray &);
50 void setDocument (const QString &); 53 void setDocument (const QString &);
@@ -60,17 +63,20 @@ private:
60 PackageManagerSettings *settings; 63 PackageManagerSettings *settings;
61 PackageList packageList; 64 PackageList packageList;
62 QAction *runAction; 65 QAction *runAction;
63 QAction *detailsAction;
64 QAction *updateAction; 66 QAction *updateAction;
65 QAction *findAction; 67 QAction *findAction;
66 QAction *sectionAction; 68 QAction *sectionAction;
69 QAction *destAction;
67 PackageListView *listViewPackages; 70 PackageListView *listViewPackages;
68 QPEToolBar *findBar; 71 QPEToolBar *findBar;
69 QLineEdit *findEdit; 72 QLineEdit *findEdit;
70 QPEToolBar *sectionBar; 73 QPEToolBar *sectionBar;
71 QComboBox *section; 74 QComboBox *section;
72 QComboBox *subsection; 75 QComboBox *subsection;
73 QMessageBox *wait; 76 QPEToolBar *destBar;
77 QComboBox *destination;
78 QCheckBox* CheckBoxLink;
79// QMessageBox *wait;
74private slots: 80private slots:
75 void rotateUpdateIcon(); 81 void rotateUpdateIcon();
76}; 82};
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro
index 1f7a70d..c5d3b3d 100644
--- a/noncore/unsupported/oipkg/oipkg.pro
+++ b/noncore/unsupported/oipkg/oipkg.pro
@@ -5,12 +5,14 @@ CONFIG = qt warn_on debug
5 HEADERS = mainwindow.h \ 5 HEADERS = mainwindow.h \
6 pksettings.h \ 6 pksettings.h \
7 pmipkg.h \ 7 pmipkg.h \
8 utils.h \
8 packagelistitem.h \ 9 packagelistitem.h \
9 packagelist.h \ 10 packagelist.h \
10 packagelistview.h \ 11 packagelistview.h \
11 package.h 12 package.h
12 SOURCES = main.cpp \ 13 SOURCES = main.cpp \
13 mainwindow.cpp \ 14 mainwindow.cpp \
15 utils.cpp \
14 packagelistview.cpp \ 16 packagelistview.cpp \
15 pksettings.cpp \ 17 pksettings.cpp \
16 pmipkg.cpp \ 18 pmipkg.cpp \
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 5f0e5fa..0499e19 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -9,9 +9,9 @@
9 9
10#include "debug.h" 10#include "debug.h"
11 11
12Package::~Package() 12//Package::~Package()
13{ 13//{
14} 14//}
15 15
16Package::Package( PackageManagerSettings *s ) 16Package::Package( PackageManagerSettings *s )
17{ 17{
@@ -61,40 +61,31 @@ Package::Package( Package *pi )
61 61
62void Package::setValue( QString n, QString t ) 62void Package::setValue( QString n, QString t )
63{ 63{
64 if ( n == "Status" && installed() ) return;
65 if ( n == "Package" ) 64 if ( n == "Package" )
66 { 65 {
67 _name = QString( t ); 66 _name = QString( t );
68 } 67 }else if ( n == "Installed-Size" )
69 if ( n == "Installed-Size" )
70 { 68 {
71 _size = t; 69 _size = t;
72 } 70 }else if ( n == "Priority")
73 if ( n == "Priority")
74 { 71 {
75 72
76 } 73 }else if ( n == "Section")
77 if ( n == "Section")
78 { 74 {
79 setSection( t ); 75 setSection( t );
80 } 76 }else if ( n == "Maintainer")
81 if ( n == "Maintainer")
82 { 77 {
83 78
84 } 79 }else if ( n == "Architecture")
85 if ( n == "Architecture")
86 { 80 {
87 81
88 } 82 }else if ( n == "Version")
89 if ( n == "Version")
90 { 83 {
91 84
92 } 85 }else if ( n == "Pre-Depends")
93 if ( n == "Pre-Depends")
94 { 86 {
95 87
96 } 88 }else if ( n == "Depends")
97 if ( n == "Depends")
98 { 89 {
99 90
100 }else if ( n == "Filename") 91 }else if ( n == "Filename")
@@ -153,6 +144,22 @@ QString Package::size()
153 return _size; 144 return _size;
154} 145}
155 146
147QString Package::sizeUnits()
148{
149 int i = _size.toInt();
150 int c = 0;
151 QString ret;
152 QStringList unit;
153 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;)
154 while (i > 1)
155 {
156 ret=QString::number(i)+" "+unit[c];
157 c++;
158 i /= 1024;
159 }
160 return ret;
161}
162
156bool Package::toProcess() 163bool Package::toProcess()
157{ 164{
158 return _toProcess; 165 return _toProcess;
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index 31b0010..49bb3bf 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -15,7 +15,7 @@ class Package //: public QObject
15 //Q_OBJECT 15 //Q_OBJECT
16 public: 16 public:
17 Package(PackageManagerSettings *); 17 Package(PackageManagerSettings *);
18 ~Package(); 18 // ~Package();
19 Package( QStringList, PackageManagerSettings * ); 19 Package( QStringList, PackageManagerSettings * );
20 Package( QString, PackageManagerSettings * ); 20 Package( QString, PackageManagerSettings * );
21 Package( Package* ); 21 Package( Package* );
@@ -30,6 +30,7 @@ class Package //: public QObject
30 QString shortDesc(); 30 QString shortDesc();
31 QString desc(); 31 QString desc();
32 QString size(); 32 QString size();
33 QString sizeUnits();
33 void setSection( QString ); 34 void setSection( QString );
34 QString section(); 35 QString section();
35 QString subSection(); 36 QString subSection();
@@ -45,7 +46,6 @@ class Package //: public QObject
45 void setLink(bool); 46 void setLink(bool);
46 void parseIpkgFile( QString );; 47 void parseIpkgFile( QString );;
47public slots: 48public slots:
48 /** No descriptions */
49 QString getPackageName(); 49 QString getPackageName();
50 void toggleProcess(); 50 void toggleProcess();
51 51
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 149ba35..0c7c928 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -17,35 +17,20 @@ PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSetti
17 settings = s; 17 settings = s;
18 setExpandable( true ); 18 setExpandable( true );
19 QCheckListItem *item; 19 QCheckListItem *item;
20#ifndef NEWLAYOUT 20 nameItem = new QCheckListItem( this, "" );
21 item = new QCheckListItem( this, QObject::tr("Name") );
22 item->setText(1,pi->name());
23 item = new QCheckListItem( this, QObject::tr("Description") );
24 item->setText(1,pi->desc()+"\ntest multi\nline");
25 item = new QCheckListItem( this, QObject::tr("Size") );
26 item->setText(1,pi->size());
27 item = new QCheckListItem( this, QObject::tr("Destination") );
28 item->setText(1,pi->getDest());
29#endif
30#ifdef NEWLAYOUT
31 item = new QCheckListItem( this, QObject::tr("Name: ")+pi->name() );
32 item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); 21 item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() );
33 item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); 22 item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() );
34 destItem = new QCheckListItem( this, "" ); 23 destItem = new QCheckListItem( this, "" );
35 linkItem = new QCheckListItem( this, "" ); 24 linkItem = new QCheckListItem( this, "" );
36 displayDetails(); 25 displayDetails();
37#endif
38 26
39 if (!pm_uninstalled) { 27 if (!pm_uninstalled)
28 {
40 pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); 29 pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled"));
41 pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); 30 pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed"));
42 pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); 31 pm_install = new QPixmap(Resource::loadPixmap("oipkg/install"));
43 pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); 32 pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall"));
44 } 33 }
45#ifndef NEWLAYOUT
46 setText(1, package->shortDesc() );
47 setText(2, package->size() );
48#endif
49} 34}
50 35
51void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, 36void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
@@ -120,19 +105,17 @@ void PackageListItem::setOn( bool b )
120{ 105{
121 QCheckListItem::setOn( b ); 106 QCheckListItem::setOn( b );
122 package->toggleProcess(); 107 package->toggleProcess();
123// if ( b )
124// {
125// if ((package->dest()).isEmpty)
126 // package->setDest( settings->getDestinationName() );
127// }else{
128// package->setDest( QObject::tr("not installed"));
129// }
130 package->setLink( settings->createLinks() ); 108 package->setLink( settings->createLinks() );
131 displayDetails(); 109 displayDetails();
132} 110}
133 111
134void PackageListItem::displayDetails() 112void PackageListItem::displayDetails()
135{ 113{
114 QString sod = " ("+package->sizeUnits();
115 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest());
116 sod += ")";
117 setText(0, package->name()+sod );
118 nameItem->setText( 0, QObject::tr("Name: ")+package->name());
136 linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) ); 119 linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) );
137 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); 120 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
138 repaint(); 121 repaint();
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h
index f695432..54d9f9e 100644
--- a/noncore/unsupported/oipkg/packagelistitem.h
+++ b/noncore/unsupported/oipkg/packagelistitem.h
@@ -27,6 +27,7 @@ public:
27 void displayDetails(); 27 void displayDetails();
28 28
29private: 29private:
30 QCheckListItem *nameItem;
30 QCheckListItem *destItem; 31 QCheckListItem *destItem;
31 QCheckListItem *linkItem; 32 QCheckListItem *linkItem;
32 PackageManagerSettings *settings; 33 PackageManagerSettings *settings;
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp
index 693ea6a..2915ac6 100644
--- a/noncore/unsupported/oipkg/packagelistview.cpp
+++ b/noncore/unsupported/oipkg/packagelistview.cpp
@@ -52,7 +52,7 @@ void PackageListView::setCurrent( QListViewItem* p )
52 if ( !p ) return; 52 if ( !p ) return;
53 activePackageListItem = (PackageListItem*)p; 53 activePackageListItem = (PackageListItem*)p;
54 activePackage = activePackageListItem->getPackage(); 54 activePackage = activePackageListItem->getPackage();
55 pvDebug(5, "start timer"); 55 if (!activePackage) return;
56 popupTimer->start( 750, true ); 56 popupTimer->start( 750, true );
57} 57}
58 58
@@ -63,21 +63,31 @@ void PackageListView::showPopup()
63 destsMenu->clear(); 63 destsMenu->clear();
64 64
65 QAction *popupAction; 65 QAction *popupAction;
66 if ( !activePackage->installed() )
67 {
66 popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); 68 popupMenu->insertItem( QObject::tr("Install to"), destsMenu );
67 QStringList dests = settings->getDestinationNames(); 69 QStringList dests = settings->getDestinationNames();
70 QString ad = settings->getDestinationName();
68 for (uint i = 0; i < dests.count(); i++ ) 71 for (uint i = 0; i < dests.count(); i++ )
69 { 72 {
70 popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); 73 popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
71 popupAction->addTo( destsMenu ); 74 popupAction->addTo( destsMenu );
75 if ( dests[i] == ad && activePackage->toInstall() )
76 {
77 popupAction->setToggleAction( true );
78 popupAction->setOn(true);
79 };
72 } 80 }
73 connect( destsMenu, SIGNAL( activated( int ) ), 81 connect( destsMenu, SIGNAL( activated( int ) ),
74 this, SLOT( changePackageDest( int ) ) ); 82 this, SLOT( changePackageDest( int ) ) );
83 }else{
84 // popupActcat setOn( activePackage->toProcess() );
85 }
75 popupMenu->popup( QCursor::pos() ); 86 popupMenu->popup( QCursor::pos() );
76} 87}
77 88
78void PackageListView::stopTimer( QListViewItem* ) 89void PackageListView::stopTimer( QListViewItem* )
79{ 90{
80 pvDebug( 5, "stop timer" );
81 popupTimer->stop(); 91 popupTimer->stop();
82} 92}
83 93
@@ -89,3 +99,9 @@ void PackageListView::changePackageDest( int i )
89 activePackage->setLink( settings->createLinks() ); 99 activePackage->setLink( settings->createLinks() );
90 activePackageListItem->displayDetails(); 100 activePackageListItem->displayDetails();
91} 101}
102
103void PackageListView::toggleProcess()
104{
105 activePackage->toggleProcess() ;
106 activePackageListItem->displayDetails();
107}
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h
index 15e200b..a3db0d0 100644
--- a/noncore/unsupported/oipkg/packagelistview.h
+++ b/noncore/unsupported/oipkg/packagelistview.h
@@ -48,6 +48,8 @@ public slots:
48 void changePackageDest( int ); 48 void changePackageDest( int );
49 void setCurrent( QListViewItem* ); 49 void setCurrent( QListViewItem* );
50 void stopTimer( QListViewItem* ); 50 void stopTimer( QListViewItem* );
51 /** No descriptions */
52 void toggleProcess();
51}; 53};
52 54
53#endif 55#endif
diff --git a/noncore/unsupported/oipkg/pkdesc.ui b/noncore/unsupported/oipkg/pkdesc.ui
deleted file mode 100644
index 494d3d6..0000000
--- a/noncore/unsupported/oipkg/pkdesc.ui
+++ b/dev/null
@@ -1,96 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>PackageDetails</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>Form7</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>221</width>
15 <height>291</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>(pkgname)</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>6</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>3</number>
36 </property>
37 <widget>
38 <class>QTextView</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>description</cstring>
42 </property>
43 </widget>
44 <widget>
45 <class>QLayoutWidget</class>
46 <property stdset="1">
47 <name>name</name>
48 <cstring>Layout4</cstring>
49 </property>
50 <hbox>
51 <property stdset="1">
52 <name>margin</name>
53 <number>0</number>
54 </property>
55 <property stdset="1">
56 <name>spacing</name>
57 <number>6</number>
58 </property>
59 <widget>
60 <class>QToolButton</class>
61 <property stdset="1">
62 <name>name</name>
63 <cstring>install</cstring>
64 </property>
65 <property stdset="1">
66 <name>text</name>
67 <string>Install</string>
68 </property>
69 </widget>
70 <widget>
71 <class>QToolButton</class>
72 <property stdset="1">
73 <name>name</name>
74 <cstring>remove</cstring>
75 </property>
76 <property stdset="1">
77 <name>text</name>
78 <string>Remove</string>
79 </property>
80 </widget>
81 <widget>
82 <class>QToolButton</class>
83 <property stdset="1">
84 <name>name</name>
85 <cstring>ignore</cstring>
86 </property>
87 <property stdset="1">
88 <name>text</name>
89 <string>Ignore</string>
90 </property>
91 </widget>
92 </hbox>
93 </widget>
94 </vbox>
95</widget>
96</UI>
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp
index be01837..6c8dc2a 100644
--- a/noncore/unsupported/oipkg/pksettings.cpp
+++ b/noncore/unsupported/oipkg/pksettings.cpp
@@ -31,6 +31,7 @@
31#include <stdlib.h> 31#include <stdlib.h>
32#include <unistd.h> 32#include <unistd.h>
33#include "debug.h" 33#include "debug.h"
34//#include "utils.h"
34 35
35PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) 36PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl )
36 : PackageManagerSettingsBase( parent, name, fl ) 37 : PackageManagerSettingsBase( parent, name, fl )
@@ -56,6 +57,7 @@ PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* na
56 destinationurl->setEnabled(FALSE); 57 destinationurl->setEnabled(FALSE);
57 destinationurlDic.setAutoDelete(TRUE); 58 destinationurlDic.setAutoDelete(TRUE);
58 readSettings(); 59 readSettings();
60 activeLinkDestination->hide();
59} 61}
60 62
61PackageManagerSettings::~PackageManagerSettings() 63PackageManagerSettings::~PackageManagerSettings()
@@ -76,8 +78,10 @@ void PackageManagerSettings::newServer()
76 servers->insertItem(servername->text()); 78 servers->insertItem(servername->text());
77 activeServers->insertItem(servername->text()); 79 activeServers->insertItem(servername->text());
78 } 80 }
81 changed = true;
79 servers->setSelected(i,TRUE); 82 servers->setSelected(i,TRUE);
80 editServer(i); 83 editServer(i);
84 changed = true;
81} 85}
82 86
83void PackageManagerSettings::newDestination() 87void PackageManagerSettings::newDestination()
@@ -97,6 +101,7 @@ void PackageManagerSettings::newDestination()
97 } 101 }
98 destinations->setSelected(i,TRUE); 102 destinations->setSelected(i,TRUE);
99 editDestination(i); 103 editDestination(i);
104 changed = true;
100} 105}
101 106
102 107
@@ -117,6 +122,7 @@ void PackageManagerSettings::editServer(int i)
117 122
118 connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); 123 connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) );
119 connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); 124 connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) );
125 changed = true;
120} 126}
121 127
122 128
@@ -137,6 +143,7 @@ void PackageManagerSettings::editDestination(int i)
137 143
138 connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); 144 connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) );
139 connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); 145 connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) );
146 changed = true;
140} 147}
141 148
142void PackageManagerSettings::removeServer() 149void PackageManagerSettings::removeServer()
@@ -151,6 +158,7 @@ void PackageManagerSettings::removeServer()
151 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); 158 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
152 servername->setEnabled(FALSE); 159 servername->setEnabled(FALSE);
153 serverurl->setEnabled(FALSE); 160 serverurl->setEnabled(FALSE);
161 changed = true;
154} 162}
155 163
156void PackageManagerSettings::removeDestination() 164void PackageManagerSettings::removeDestination()
@@ -166,6 +174,7 @@ void PackageManagerSettings::removeDestination()
166 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); 174 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) );
167 destinationname->setEnabled(FALSE); 175 destinationname->setEnabled(FALSE);
168 destinationurl->setEnabled(FALSE); 176 destinationurl->setEnabled(FALSE);
177 changed = true;
169} 178}
170 179
171void PackageManagerSettings::serverNameChanged(const QString& t) 180void PackageManagerSettings::serverNameChanged(const QString& t)
@@ -173,7 +182,9 @@ void PackageManagerSettings::serverNameChanged(const QString& t)
173 disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); 182 disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
174 servers->changeItem( t, editedserver ); 183 servers->changeItem( t, editedserver );
175 activeServers->changeItem( t, editedserver ); 184 activeServers->changeItem( t, editedserver );
185 changed = true;
176 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); 186 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
187 changed = true;
177} 188}
178 189
179void PackageManagerSettings::destNameChanged(const QString& t) 190void PackageManagerSettings::destNameChanged(const QString& t)
@@ -183,16 +194,19 @@ void PackageManagerSettings::destNameChanged(const QString& t)
183 activeDestination->changeItem( t, editeddestination ); 194 activeDestination->changeItem( t, editeddestination );
184 activeLinkDestination->changeItem( t, editeddestination ); 195 activeLinkDestination->changeItem( t, editeddestination );
185 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); 196 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) );
197 changed = true;
186} 198}
187 199
188void PackageManagerSettings::serverUrlChanged(const QString& t) 200void PackageManagerSettings::serverUrlChanged(const QString& t)
189{ 201{
190 serverurlDic.replace(editedserver, new QString(t)); 202 serverurlDic.replace(editedserver, new QString(t));
203 changed = true;
191} 204}
192 205
193void PackageManagerSettings::destUrlChanged(const QString& t) 206void PackageManagerSettings::destUrlChanged(const QString& t)
194{ 207{
195 destinationurlDic.replace(editeddestination, new QString(t)); 208 destinationurlDic.replace(editeddestination, new QString(t));
209 changed = true;
196} 210}
197 211
198void PackageManagerSettings::writeIpkgConfig(const QString& conffile) 212void PackageManagerSettings::writeIpkgConfig(const QString& conffile)
@@ -265,11 +279,11 @@ void PackageManagerSettings::installationSettingChange(int cs)
265 writeCurrentInstallationSetting(); 279 writeCurrentInstallationSetting();
266 currentSetting = cs; 280 currentSetting = cs;
267 readInstallationSetting( cs ); 281 readInstallationSetting( cs );
282 changed = true;
268} 283}
269 284
270void PackageManagerSettings::writeInstallationSettings() 285void PackageManagerSettings::writeInstallationSettings()
271{ 286{
272 if ( ! changed ) return ;
273 { 287 {
274 Config cfg( "oipkg", Config::User ); 288 Config cfg( "oipkg", Config::User );
275 cfg.setGroup( "Settings" ); 289 cfg.setGroup( "Settings" );
@@ -285,12 +299,11 @@ void PackageManagerSettings::readInstallationSetting(int setting)
285 if ( setting < 0 ) return; 299 if ( setting < 0 ) return;
286 Config cfg( "oipkg", Config::User ); 300 Config cfg( "oipkg", Config::User );
287 cfg.setGroup( "Setting_" + QString::number( setting ) ); 301 cfg.setGroup( "Setting_" + QString::number( setting ) );
288 CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); 302 CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) );
289 QString dest = cfg.readEntry( "dest" ); 303 QString dest = cfg.readEntry( "dest" );
290 QString linkdest = cfg.readEntry( "linkdest" ); 304 QString linkdest = cfg.readEntry( "linkdest" );
291 pvDebug(3, "dest="+dest); 305 pvDebug(3, "dest="+dest);
292 pvDebug(3, "linkdest="+linkdest); 306 pvDebug(3, "linkdest="+linkdest);
293
294 for ( int i = 0; i < activeDestination->count(); i++) 307 for ( int i = 0; i < activeDestination->count(); i++)
295 { 308 {
296 if ( activeDestination->text( i ) == dest ) 309 if ( activeDestination->text( i ) == dest )
@@ -303,7 +316,6 @@ void PackageManagerSettings::readInstallationSetting(int setting)
303void PackageManagerSettings::writeCurrentInstallationSetting() 316void PackageManagerSettings::writeCurrentInstallationSetting()
304{ 317{
305 Config cfg( "oipkg", Config::User ); 318 Config cfg( "oipkg", Config::User );
306 changed = false;
307 cfg.setGroup( "Setting_" + QString::number(currentSetting) ); 319 cfg.setGroup( "Setting_" + QString::number(currentSetting) );
308 cfg.writeEntry( "link", CheckBoxLink->isChecked() ); 320 cfg.writeEntry( "link", CheckBoxLink->isChecked() );
309 cfg.writeEntry( "dest", getDestinationName() ); 321 cfg.writeEntry( "dest", getDestinationName() );
@@ -332,6 +344,7 @@ void PackageManagerSettings::installationSettingSetName(const QString &name)
332bool PackageManagerSettings::readIpkgConfig(const QString& conffile) 344bool PackageManagerSettings::readIpkgConfig(const QString& conffile)
333{ 345{
334 QFile conf(conffile); 346 QFile conf(conffile);
347 changed = false;
335 if ( conf.open(IO_ReadOnly) ) { 348 if ( conf.open(IO_ReadOnly) ) {
336 QTextStream s(&conf); 349 QTextStream s(&conf);
337 servers->clear(); 350 servers->clear();
@@ -424,7 +437,7 @@ void PackageManagerSettings::readSettings()
424 437
425void PackageManagerSettings::writeSettings() 438void PackageManagerSettings::writeSettings()
426{ 439{
427 writeIpkgConfig("/etc/ipkg.conf"); 440 if ( changed ) writeIpkgConfig("/etc/ipkg.conf");
428 writeInstallationSettings(); 441 writeInstallationSettings();
429} 442}
430/** shows the setting dialog */ 443/** shows the setting dialog */
@@ -435,7 +448,7 @@ bool PackageManagerSettings::showDialog( int i )
435 bool ret = exec(); 448 bool ret = exec();
436 if ( ret ) writeSettings(); 449 if ( ret ) writeSettings();
437 else readSettings(); 450 else readSettings();
438 return ret; 451 return (changed && ret);
439} 452}
440/** Returns the installation destination */ 453/** Returns the installation destination */
441QString PackageManagerSettings::getDestinationName() 454QString PackageManagerSettings::getDestinationName()
@@ -469,6 +482,15 @@ QStringList PackageManagerSettings::getActiveServers()
469 } 482 }
470 return sl; 483 return sl;
471} 484}
485 QStringList PackageManagerSettings::getServers()
486{
487 QStringList sl;
488 for (int i=0; i<(int)activeServers->count(); i++)
489 {
490 sl += activeServers->text(i);
491 }
492 return sl;
493}
472 494
473/** returns the destination listed in ipkg.conf */ 495/** returns the destination listed in ipkg.conf */
474QStringList PackageManagerSettings::getDestinationUrls() 496QStringList PackageManagerSettings::getDestinationUrls()
@@ -506,6 +528,15 @@ QStringList PackageManagerSettings::getDestinationNames()
506 528
507void PackageManagerSettings::linkEnabled( bool b ) 529void PackageManagerSettings::linkEnabled( bool b )
508{ 530{
509 changed = true;
510 activeLinkDestination->setEnabled( b ); 531 activeLinkDestination->setEnabled( b );
511} 532}
533
534void PackageManagerSettings::activeServerChanged()
535{
536 changed = true;
537}
538
539QComboBox* PackageManagerSettings::getDestCombo()
540{
541 return new QComboBox(activeDestination);
542}
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h
index 11ba55c..fbb3b99 100644
--- a/noncore/unsupported/oipkg/pksettings.h
+++ b/noncore/unsupported/oipkg/pksettings.h
@@ -17,10 +17,13 @@ public:
17 QString getDestinationName(); 17 QString getDestinationName();
18 QString getLinkDestinationName(); 18 QString getLinkDestinationName();
19 bool createLinks(); 19 bool createLinks();
20 QStringList getServers();
20 QStringList getActiveServers(); 21 QStringList getActiveServers();
21 QStringList getDestinationUrls(); 22 QStringList getDestinationUrls();
22 QStringList getDestinationNames(); 23 QStringList getDestinationNames();
23 QString getDestinationUrlByName(QString); 24 QString getDestinationUrlByName(QString);
25 /** No descriptions */
26 QComboBox* getDestCombo();
24 27
25private: 28private:
26 QIntDict<QString> serverurlDic; 29 QIntDict<QString> serverurlDic;
@@ -59,6 +62,7 @@ public slots:
59 void newInstallationSetting(); 62 void newInstallationSetting();
60 void removeInstallationSetting(); 63 void removeInstallationSetting();
61 void renameInstallationSetting(); 64 void renameInstallationSetting();
65 void activeServerChanged();
62}; 66};
63 67
64#endif 68#endif
diff --git a/noncore/unsupported/oipkg/pksettingsbase.ui b/noncore/unsupported/oipkg/pksettingsbase.ui
index 196a89f..fd6d208 100644
--- a/noncore/unsupported/oipkg/pksettingsbase.ui
+++ b/noncore/unsupported/oipkg/pksettingsbase.ui
@@ -11,7 +11,7 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>349</width> 14 <width>345</width>
15 <height>454</height> 15 <height>454</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
@@ -176,7 +176,7 @@
176 </property> 176 </property>
177 <property stdset="1"> 177 <property stdset="1">
178 <name>text</name> 178 <name>text</name>
179 <string>Link Destination: root</string> 179 <string>Link to root destination</string>
180 </property> 180 </property>
181 </widget> 181 </widget>
182 <widget> 182 <widget>
@@ -718,6 +718,24 @@
718 </grid> 718 </grid>
719</widget> 719</widget>
720<connections> 720<connections>
721 <connection>
722 <sender>activeServers</sender>
723 <signal>pressed(QListBoxItem*)</signal>
724 <receiver>Form4</receiver>
725 <slot>activeServerChanged()</slot>
726 </connection>
727 <connection>
728 <sender>activeServers</sender>
729 <signal>selectionChanged(QListBoxItem*)</signal>
730 <receiver>Form4</receiver>
731 <slot>activeServerChanged()</slot>
732 </connection>
733 <connection>
734 <sender>activeServers</sender>
735 <signal>pressed(QListBoxItem*)</signal>
736 <receiver>Form4</receiver>
737 <slot>activeServerChanged()</slot>
738 </connection>
721 <slot access="public">destNameChanged(const QString&amp;)</slot> 739 <slot access="public">destNameChanged(const QString&amp;)</slot>
722 <slot access="public">destUrlChanged(const QString&amp;)</slot> 740 <slot access="public">destUrlChanged(const QString&amp;)</slot>
723 <slot access="public">editDestination(int)</slot> 741 <slot access="public">editDestination(int)</slot>
@@ -728,6 +746,7 @@
728 <slot access="public">newDestination()</slot> 746 <slot access="public">newDestination()</slot>
729 <slot access="public">newInstallationSetting()</slot> 747 <slot access="public">newInstallationSetting()</slot>
730 <slot access="public">newServer()</slot> 748 <slot access="public">newServer()</slot>
749 <slot access="public">activeServerChanged()</slot>
731 <slot access="public">removeDestination()</slot> 750 <slot access="public">removeDestination()</slot>
732 <slot access="public">removeInstallationSetting()</slot> 751 <slot access="public">removeInstallationSetting()</slot>
733 <slot access="public">removeServer()</slot> 752 <slot access="public">removeServer()</slot>
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index ecc97b2..9f6429a 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -9,6 +9,7 @@
9#include <qpe/stringutil.h> 9#include <qpe/stringutil.h>
10#include <qdir.h> 10#include <qdir.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qgroupbox.h>
12#include <qmultilineedit.h> 13#include <qmultilineedit.h>
13#include <qstring.h> 14#include <qstring.h>
14#include <qcheckbox.h> 15#include <qcheckbox.h>
@@ -57,8 +58,15 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
57 58
58 cmd += " -force-defaults "; 59 cmd += " -force-defaults ";
59 60
60// if (runwindow->forcedepends->isChecked()) 61 if (_force_depends)
61 // cmd += " -force-depends "; 62 {
63 if (_force_depends->isChecked())
64 cmd += " -force-depends ";
65 if (_force_reinstall->isChecked())
66 cmd += " -force-reinstall ";
67 if (_force_remove->isChecked())
68 cmd += " -force-removal-of-essential-packages ";
69 }
62 70
63 out( "<hr><br>Starting to "+ args+"<br>\n"); 71 out( "<hr><br>Starting to "+ args+"<br>\n");
64 cmd += args; 72 cmd += args;
@@ -81,9 +89,7 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
81 QString line; 89 QString line;
82 QString oldLine; 90 QString oldLine;
83 while ( ! f.open(IO_ReadOnly) ) {}; 91 while ( ! f.open(IO_ReadOnly) ) {};
84 // {
85 QTextStream t( &f ); 92 QTextStream t( &f );
86 // QString fp;
87 while ( !t.eof() ) 93 while ( !t.eof() )
88 { 94 {
89 line = t.readLine(); 95 line = t.readLine();
@@ -93,7 +99,6 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
93 oldLine = line; 99 oldLine = line;
94 } 100 }
95 } 101 }
96// }
97 f.close(); 102 f.close();
98 out( "Finished!<br>"); 103 out( "Finished!<br>");
99#endif 104#endif
@@ -104,41 +109,61 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
104void PmIpkg::makeLinks(Package *pack) 109void PmIpkg::makeLinks(Package *pack)
105{ 110{
106 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 111 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
107 QString dest = settings->getDestinationUrlByName( pack->dest() ); 112 linkPackage( pack->name(), pack->dest() );
108 if (dest == "/" ) return; 113}
114
115QStringList* PmIpkg::getList( QString packFileName, QString d )
116{
117 QString dest = settings->getDestinationUrlByName( d );
118 dest = dest==""?d:dest;
119 if (dest == "/" ) return 0;
109 { 120 {
110 Config cfg( "oipkg", Config::User ); 121 Config cfg( "oipkg", Config::User );
111 cfg.setGroup( "Common" ); 122 cfg.setGroup( "Common" );
112 QString statusDir = cfg.readEntry( "statusDir", "" ); 123 QString statusDir = cfg.readEntry( "statusDir", "" );
113 } 124 }
114 QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; 125 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list";
115 linkPackage( fn, dest );
116}
117
118void PmIpkg::linkPackage( QString packFileName, QString dest )
119{
120 QFile f( packFileName ); 126 QFile f( packFileName );
121 if ( ! f.open(IO_ReadOnly) ) 127 if ( ! f.open(IO_ReadOnly) )
122 { 128 {
129 pvDebug(1," Panik! Could not open");
123 out( "<b>Panik!</b> Could not open:<br>"+packFileName ); 130 out( "<b>Panik!</b> Could not open:<br>"+packFileName );
124 return; 131 return (QStringList*)0;
125 }; 132 }
126 out( "<br>creating links<br>" ); 133 QStringList *fileList = new QStringList();
127 out("for package "+packFileName+" in "+dest+"<br>");
128 QTextStream t( &f ); 134 QTextStream t( &f );
129 QString fp;
130 while ( !t.eof() ) 135 while ( !t.eof() )
131 { 136 {
132 fp = t.readLine(); 137 *fileList += t.readLine();
133 processLinkDir( fp, dest );
134 } 138 }
135 f.close(); 139 return fileList;
136} 140}
137 141
142void PmIpkg::linkPackage( QString packFileName, QString dest )
143{
144 QStringList *fileList = getList( packFileName, dest );
145 processFileList( fileList, dest );
146 delete fileList;
147}
148
149void PmIpkg::processFileList( QStringList *fileList, QString d )
150{
151 if (!fileList) return;
152 for (uint i=0; i < fileList->count(); i++)
153 {
154 QString dest = settings->getDestinationUrlByName( d );
155 dest = dest==""?d:dest;
156 processLinkDir( (*fileList)[i], dest );
157 }
158}
159
160
138void PmIpkg::processLinkDir( QString file, QString dest ) 161void PmIpkg::processLinkDir( QString file, QString dest )
139{ 162{
140 pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); 163 pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest);
141 if ( dest == "???" ) return; 164 if (linkOpp==createLink) pvDebug( 2,"opp: createLink");
165 if (linkOpp==removeLink) pvDebug( 2,"opp:removeLink");
166 if ( dest == "???" || dest == "" ) return;
142 QString destFile = file; 167 QString destFile = file;
143 file = dest+"/"+file; 168 file = dest+"/"+file;
144 if (file == dest) return; 169 if (file == dest) return;
@@ -146,7 +171,7 @@ void PmIpkg::processLinkDir( QString file, QString dest )
146 if ( fileInfo.isDir() ) 171 if ( fileInfo.isDir() )
147 { 172 {
148 QDir destDir( destFile ); 173 QDir destDir( destFile );
149 destDir.mkdir( destFile, true ); 174 if (linkOpp==createLink) destDir.mkdir( destFile, true );
150 QDir d( file ); 175 QDir d( file );
151 d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 176 d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
152 const QFileInfoList *list = d.entryInfoList(); 177 const QFileInfoList *list = d.entryInfoList();
@@ -154,19 +179,35 @@ void PmIpkg::processLinkDir( QString file, QString dest )
154 QFileInfo *fi; 179 QFileInfo *fi;
155 while ( (fi=it.current()) ) 180 while ( (fi=it.current()) )
156 { 181 {
157 // out( "<b>"+fi->absFilePath()+"</b>" ); 182 pvDebug(4, "process dir "+fi->absFilePath());
158 processLinkDir( fi->absFilePath(), dest ); 183 processLinkDir( fi->absFilePath(), dest );
159 ++it; 184 ++it;
160 } 185 }
186// if (linkOpp==removeLink)
187// {
188 // pvDebug(2,"remove destDir "+ destFile );
189 // destDir.remove( destFile, true );
190// }
161 } else 191 } else
162 if ( fileInfo.isFile() ) 192 if ( fileInfo.isFile() )
163 { 193 {
164 const char *instFile = strdup( (file).ascii() ); 194 const char *instFile = strdup( (file).ascii() );
165 const char *linkFile = strdup( (destFile).ascii()); 195 const char *linkFile = strdup( (destFile).ascii());
166// out( "linking: "+file+" -> "+destFile ); 196 if( linkOpp==createLink )
167 qDebug( "linking: %s -> %s", instFile, linkFile ); 197 {
198 pvDebug(4, "linking: "+file+" -> "+destFile );
168 symlink( instFile, linkFile ); 199 symlink( instFile, linkFile );
169 } 200 }
201 } else {
202 const char *linkFile = strdup( (destFile).ascii());
203 if( linkOpp==removeLink )
204 {
205 pvDebug(4,"removing "+destFile+" no "+file);
206 QFileInfo toRemoveLink( destFile );
207 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
208 unlink( linkFile );
209 }
210 }
170} 211}
171 212
172void PmIpkg::commit( PackageList pl ) 213void PmIpkg::commit( PackageList pl )
@@ -176,7 +217,6 @@ void PmIpkg::commit( PackageList pl )
176 to_remove.clear(); 217 to_remove.clear();
177 QString rem="<b>"+tr("To remove:")+"</b><br>\n"; 218 QString rem="<b>"+tr("To remove:")+"</b><br>\n";
178 QString inst="<b>"+tr("To install:")+"</b><br>\n"; 219 QString inst="<b>"+tr("To install:")+"</b><br>\n";
179 pl.allPackages();
180 for( Package *pack = pl.first();pack ; (pack = pl.next()) ) 220 for( Package *pack = pl.first();pack ; (pack = pl.next()) )
181 { 221 {
182 if ( pack && (pack->name() != "") && pack) 222 if ( pack && (pack->name() != "") && pack)
@@ -207,70 +247,66 @@ void PmIpkg::startDialog()
207 RunWindowLayout->setSpacing( 2 ); 247 RunWindowLayout->setSpacing( 2 );
208 RunWindowLayout->setMargin( 2 ); 248 RunWindowLayout->setMargin( 2 );
209 249
210 QHBoxLayout *buttons = new QHBoxLayout;
211 buttons->setSpacing( 6 );
212 buttons->setMargin( 0 );
213
214 PackageListView *plv = new PackageListView(installDialog, "install",settings); 250 PackageListView *plv = new PackageListView(installDialog, "install",settings);
251 plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) );
215 RunWindowLayout->addWidget( plv, 1, 0 ); 252 RunWindowLayout->addWidget( plv, 1, 0 );
253 QCheckListItem *toRemoveItem;
254 toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") );
255 toRemoveItem->setOpen( true );
216 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 256 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
217 { 257 {
218 plv->insertItem( new PackageListItem(plv, it,settings) ); 258 toRemoveItem->insertItem( new PackageListItem(plv, it,settings) );
219 } 259 }
260 QCheckListItem *toInstallItem;
261 toInstallItem = new QCheckListItem( plv, QObject::tr("To install") );
262 toInstallItem->setOpen( true );
220 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 263 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
221 { 264 {
222 plv->insertItem( new PackageListItem(plv, it,settings) ); 265 toInstallItem->insertItem( new PackageListItem(plv, it,settings) );
223 } 266 }
224 QPushButton *doItButton = new QPushButton( installDialog, "doItButton" ); 267
225 doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); 268 QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" );
226 QFont doItButton_font( doItButton->font() ); 269 GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().hasHeightForWidth() ) );
227 doItButton_font.setPointSize( 8 ); 270 GroupBox1->setTitle( tr( "Ipkg options" ) );
228 doItButton->setFont( doItButton_font ); 271 GroupBox1->setColumnLayout(0, Qt::Vertical );
229 doItButton->setText( tr( "Do all " ) ); 272 GroupBox1->layout()->setSpacing( 0 );
230 doItButton->setAutoResize( FALSE ); 273 GroupBox1->layout()->setMargin( 0 );
231 buttons->addWidget( doItButton ); 274 QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
232 275 GroupBox1Layout->setAlignment( Qt::AlignTop );
233 QPushButton *installButton = new QPushButton( installDialog, "installButton" ); 276 GroupBox1Layout->setSpacing( 3 );
234 QFont installButton_font( installButton->font() ); 277 GroupBox1Layout->setMargin( 3 );
235 installButton_font.setPointSize( 8 ); 278
236 installButton->setFont( installButton_font ); 279 _force_depends = new QCheckBox( GroupBox1, "_force_depends" );
237 installButton->setText( tr( "Install" ) ); 280 _force_depends->setText( tr( "-force-depends" ) );
238 installButton->setAutoResize( TRUE ); 281 _force_depends->setAutoResize( TRUE );
239 buttons->addWidget( installButton ); 282 GroupBox1Layout->addWidget( _force_depends, 0, 0 );
240 283 _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" );
241 QPushButton *removeButton = new QPushButton( installDialog, "removeButton" ); 284 _force_reinstall->setText( tr( "-force-reinstall" ) );
242 QFont removeButton_font( removeButton->font() ); 285 _force_reinstall->setAutoResize( TRUE );
243 removeButton_font.setPointSize( 7 ); 286 GroupBox1Layout->addWidget( _force_reinstall, 1, 0 );
244 removeButton->setFont( removeButton_font ); 287 _force_remove = new QCheckBox( GroupBox1, "_force_remove" );
245 removeButton->setText( tr( "Remove" ) ); 288 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
246 removeButton->setAutoResize( TRUE ); 289 _force_remove->setAutoResize( TRUE );
247 buttons->addWidget( removeButton ); 290 GroupBox1Layout->addWidget( _force_remove, 1, 0 );
248 291 RunWindowLayout->addWidget( GroupBox1 , 3, 0 );
249 QPushButton *cancelButton = new QPushButton( installDialog, "cancelButton" ); 292
250 QFont cancelButton_font( cancelButton->font() ); 293// connect( doItButton, SIGNAL( clicked() ),
251 cancelButton_font.setPointSize( 8 ); 294 // this, SLOT( doIt() ) );
252 cancelButton->setFont( cancelButton_font ); 295// connect( installButton, SIGNAL( clicked() ),
253 cancelButton->setText( tr( "Cancel" ) ); 296 // this, SLOT( install() ) );
254 cancelButton->setAutoResize( TRUE ); 297// connect( removeButton, SIGNAL( clicked() ),
255 buttons->addWidget( cancelButton ); 298 // this, SLOT( remove() ) );
256 299// connect( cancelButton, SIGNAL( clicked() ),
257 RunWindowLayout->addLayout( buttons, 3, 0 ); 300 // installDialog, SLOT( close() ) );
258
259 connect( doItButton, SIGNAL( clicked() ),
260 this, SLOT( doIt() ) );
261 connect( installButton, SIGNAL( clicked() ),
262 this, SLOT( install() ) );
263 connect( removeButton, SIGNAL( clicked() ),
264 this, SLOT( remove() ) );
265 connect( cancelButton, SIGNAL( clicked() ),
266 installDialog, SLOT( close() ) );
267 installDialog->showMaximized(); 301 installDialog->showMaximized();
268 if ( installDialog->exec() ) doIt(); 302 if ( installDialog->exec() ) doIt();
269 installDialog->close(); 303 installDialog->close();
304 out(tr("<b>All done.</b>"));
270} 305}
271 306
272void PmIpkg::doIt() 307void PmIpkg::doIt()
273{ 308{
309 show( true );
274 remove(); 310 remove();
275 install(); 311 install();
276} 312}
@@ -279,59 +315,77 @@ void PmIpkg::doIt()
279void PmIpkg::remove() 315void PmIpkg::remove()
280{ 316{
281 if ( to_remove.count() == 0 ) return; 317 if ( to_remove.count() == 0 ) return;
282 installDialog->close();
283 show( true );
284 318
285 out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); 319 out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>");
286 320
321 QStringList *fileList;
287 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 322 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
288 { 323 {
324 if ( it->link() )fileList = getList( it->name(), it->dest() );
289 if ( runIpkg("remove " + it->name()) == 0) 325 if ( runIpkg("remove " + it->name()) == 0)
290 { 326 {
291 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 327 runwindow->progress->setProgress( 1 + runwindow->progress->progress() );
328 linkOpp = removeLink;
329 if ( it->link() )
330 {
331 out( "<br>removing links<br>" );
332 out( "for package "+it->name()+" in "+it->dest()+"<br>" );
333 processFileList( fileList, it->dest() );
334 }
292 it->processed(); 335 it->processed();
293 runwindow->progress->setProgress( 1 ); 336 out("<br><hr>");
294 }else{ 337 }else{
295 out("<b>"+tr("Error while removing")+"</b>"+it->name()); 338 out("<b>"+tr("Error while removing")+"</b><hr>"+it->name());
296 } 339 }
340 pvDebug(2,"delete File List");
341 if ( it->link() )delete fileList;
297 } 342 }
343 out("<br>");
298} 344}
299 345
300 346
301void PmIpkg::install() 347void PmIpkg::install()
302{ 348{
303 if ( to_install.count() == 0 ) return; 349 if ( to_install.count() == 0 ) return;
304 installDialog->close(); 350 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
305 show( true );
306 out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
307 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 351 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
308 { 352 {
309 353
310 if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) 354 if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 )
311 { 355 {
312 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 356 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
357 linkOpp = createLink;
313 if ( it->link() ) 358 if ( it->link() )
359 {
360 out( "<br>creating links<br>" );
361 out( "for package "+it->name()+" in "+it->dest()+"<br>" );
314 makeLinks( it ); 362 makeLinks( it );
363 }
315 it->processed(); 364 it->processed();
365 out("<br><hr>");
316 }else{ 366 }else{
317 out("<b>"+tr("Error while installing")+"</b>"+it->name()); 367 out("<b>"+tr("Error while installing")+"</b><hr>"+it->name());
318 } 368 }
319 } 369 }
370 out("<br>");
320} 371}
321 372
322void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) 373void PmIpkg::createLinks( const QString &dest )
323{ 374{
324 qDebug("msg="+msg+" -- "+QString(dest) ); 375 pvDebug(2,"PmIpkg::createLinks "+dest);
325// QDir d( src ); 376 linkOpp=createLink;
326// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 377 QString url = settings->getDestinationUrlByName( dest );
327//// if (! d.exists() ) return; 378 url = url==""?dest:url;
328// const QFileInfoList *list = d.entryInfoList(); 379 processLinkDir( "/", url );
329// QFileInfoListIterator it( *list ); 380}
330// QFileInfo *fi; 381
331// while ( (fi=it.current()) ) { 382void PmIpkg::removeLinks( const QString &dest )
332 // processLinkDir( fi->absFilePath(), dest ); 383{
333// ++it; 384 pvDebug(2,"PmIpkg::removeLinks "+dest);
334// } 385 linkOpp=removeLink;
386 QString url = settings->getDestinationUrlByName( dest );
387 url = url==""?dest:url;
388 processLinkDir( "/", url );
335} 389}
336 390
337void PmIpkg::update() 391void PmIpkg::update()
@@ -343,7 +397,9 @@ void PmIpkg::update()
343 397
344void PmIpkg::out( QString o ) 398void PmIpkg::out( QString o )
345{ 399{
346 runwindow->outPut->setText( runwindow->outPut->text()+o ); 400 runwindow->outPut->append(o);
401 //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight());
402 //runwindow->outPut->setText( runwindow->outPut->text()+o );
347 runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); 403 runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight());
348} 404}
349 405
@@ -376,13 +432,29 @@ void PmIpkg::show(bool b)
376 runwindow->progress->show(); 432 runwindow->progress->show();
377} 433}
378 434
379void PmIpkg::installFile(const QString &fileName) 435void PmIpkg::installFile(const QString &fileName, const QString &dest)
380{ 436{
381 437
382 to_install.clear(); 438 to_install.clear();
383 to_remove.clear(); 439 to_remove.clear();
384 pvDebug( 2,"PmIpkg::installFile "+ fileName); 440 pvDebug( 2,"PmIpkg::installFile "+ fileName);
385 to_install.append( new Package(fileName,settings) ); 441 Package *p = new Package(fileName,settings);
442 if ( dest!="") p->setDest( dest );
443 to_install.append( p );
444 startDialog();
445 delete p;
446}
447
448void PmIpkg::removeFile(const QString &fileName, const QString &dest)
449{
450
451 to_install.clear();
452 to_remove.clear();
453 pvDebug( 2,"PmIpkg::removeFile "+ fileName);
454 Package *p = new Package(fileName,settings);
455 if ( dest!="") p->setDest( dest );
456 to_remove.append( p );
386 startDialog(); 457 startDialog();
458 delete p;
387} 459}
388 460
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index c5e6255..0625032 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -11,6 +11,9 @@
11#include "packagelist.h" 11#include "packagelist.h"
12#include "debug.h" 12#include "debug.h"
13 13
14#define createLink 0
15#define removeLink 1
16
14class Package; 17class Package;
15class PmIpkg : public QObject 18class PmIpkg : public QObject
16{ 19{
@@ -19,12 +22,22 @@ public:
19 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); 22 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
20 ~PmIpkg(); 23 ~PmIpkg();
21 24
25 int linkOpp;
22 void commit( PackageList ); 26 void commit( PackageList );
23 void update(); 27 void update();
24 PackageList* getPackageList(); 28 // PackageList* getPackageList();
25 void showButtons(bool b=true); 29 void showButtons(bool b=true);
26 void show( bool buttons=true ); 30 void show( bool buttons=true );
27 31
32public slots:
33 void doIt();
34 void install();
35 void remove();
36 void installFile(const QString &fileName, const QString &dest="");
37 void removeFile(const QString &fileName, const QString &dest="");
38 void createLinks( const QString &dest );
39 void removeLinks( const QString &dest );
40
28private: 41private:
29 PackageManagerSettings* settings; 42 PackageManagerSettings* settings;
30 RunWindow *runwindow; 43 RunWindow *runwindow;
@@ -33,20 +46,19 @@ private:
33 QList<Package> to_install; 46 QList<Package> to_install;
34 bool runwindowopen; 47 bool runwindowopen;
35 QString fileNameToInstall; 48 QString fileNameToInstall;
36 49 QCheckBox *_force_reinstall;
50 QCheckBox *_force_remove;
51 QCheckBox *_force_depends;
37 void startDialog(); 52 void startDialog();
38 void makeLinks(Package*); 53 void makeLinks(Package*);
39 void linkPackage( QString, QString ); 54 void linkPackage( QString, QString );
40 void processLinkDir( QString, QString ); 55 void processLinkDir( QString, QString );
41 int runIpkg(const QString& args, const QString& dest="" ); 56 int runIpkg(const QString& args, const QString& dest="" );
42 void out( QString ); 57 void out( QString );
58 QStringList* getList( QString, QString );
59 void processFileList( QStringList*, QString );
60
43 61
44public slots:
45 void doIt();
46 void install();
47 void remove();
48 void installFile(const QString &fileName);
49 void linkDestination( const QString, const QByteArray );
50}; 62};
51 63
52#endif 64#endif
diff --git a/noncore/unsupported/oipkg/settings.cpp b/noncore/unsupported/oipkg/settings.cpp
index 2b324be..8f91995 100644
--- a/noncore/unsupported/oipkg/settings.cpp
+++ b/noncore/unsupported/oipkg/settings.cpp
@@ -434,3 +434,8 @@ void PackageManagerSettings::linkEnabled( bool b )
434{ 434{
435 activeLinkDestination->setEnabled( b ); 435 activeLinkDestination->setEnabled( b );
436} 436}
437
438void PackageManagerSettings::activeDestinationChange(int i)
439{
440 activeLinkDestination->setCurrentItem( i );
441} \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h
index cf6e614..e2072f1 100644
--- a/noncore/unsupported/oipkg/settings.h
+++ b/noncore/unsupported/oipkg/settings.h
@@ -21,28 +21,13 @@ public:
21 QStringList getActiveServers(); 21 QStringList getActiveServers();
22 QStringList getDestinationUrls(); 22 QStringList getDestinationUrls();
23 23
24private:
25 QIntDict<QString> serverurlDic;
26 QIntDict<QString> destinationurlDic;
27 int ipkg_old;
28 int editedserver;
29 int editeddestination;
30 int currentSetting;
31 int installationSettingsCount;
32 bool changed;
33
34 bool readIpkgConfig(const QString&);
35 void writeIpkgConfig(const QString&);
36 void writeSettings();
37 void readSettings();
38
39public slots: 24public slots:
40 void writeInstallationSettings(); 25 void writeInstallationSettings();
41 void readInstallationSettings(); 26 void readInstallationSettings();
42 void writeCurrentInstallationSetting(); 27 void writeCurrentInstallationSetting();
43 void readInstallationSetting(int); 28 void readInstallationSetting(int);
44 void installationSettingSetName(const QString &); 29 void installationSettingSetName(const QString &);
45 30 void activeDestinationChange(int)
46 void newServer(); 31 void newServer();
47 void editServer(int); 32 void editServer(int);
48 void removeDestination(); 33 void removeDestination();
@@ -58,6 +43,21 @@ public slots:
58 void newInstallationSetting(); 43 void newInstallationSetting();
59 void removeInstallationSetting(); 44 void removeInstallationSetting();
60 void renameInstallationSetting(); 45 void renameInstallationSetting();
46
47private:
48 QIntDict<QString> serverurlDic;
49 QIntDict<QString> destinationurlDic;
50 int ipkg_old;
51 int editedserver;
52 int editeddestination;
53 int currentSetting;
54 int installationSettingsCount;
55 bool changed;
56
57 bool readIpkgConfig(const QString&);
58 void writeIpkgConfig(const QString&);
59 void writeSettings();
60 void readSettings();
61}; 61};
62 62
63#endif 63#endif
diff --git a/noncore/unsupported/oipkg/utils.cpp b/noncore/unsupported/oipkg/utils.cpp
new file mode 100644
index 0000000..13b17fb
--- a/dev/null
+++ b/noncore/unsupported/oipkg/utils.cpp
@@ -0,0 +1,27 @@
1/***************************************************************************
2 utils.cpp - description
3 -------------------
4 begin : Sun Apr 28 2002
5 copyright : (C) 2002 by tille
6 email : tille@handhelds.org
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include <qcombobox.h>
19#include <qstring.h>
20#include "utils.h"
21
22void setComboName( QComboBox* combo, QString s)
23{
24 for ( int i = 0; i < combo->count(); i++)
25 if ( combo->text( i ) == s )
26 combo->setCurrentItem( i );
27} \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/utils.h b/noncore/unsupported/oipkg/utils.h
new file mode 100644
index 0000000..bb033c5
--- a/dev/null
+++ b/noncore/unsupported/oipkg/utils.h
@@ -0,0 +1,18 @@
1/***************************************************************************
2 utils.h - description
3 -------------------
4 begin : Sun Apr 28 2002
5 copyright : (C) 2002 by tille
6 email : tille@handhelds.org
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18void setComboName( QComboBox*, QString ); \ No newline at end of file