author | tille <tille> | 2002-04-29 22:45:35 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-29 22:45:35 (UTC) |
commit | b794af4c50efffe239c94e5a015e90565ff991c3 (patch) (unidiff) | |
tree | dd4e20851eba8052a07396b57388f9216f85ae7f | |
parent | e4d0908ec054b71a9b97e9c35efbd5a697d0b58d (diff) | |
download | opie-b794af4c50efffe239c94e5a015e90565ff991c3.zip opie-b794af4c50efffe239c94e5a015e90565ff991c3.tar.gz opie-b794af4c50efffe239c94e5a015e90565ff991c3.tar.bz2 |
removes links again
21 files changed, 545 insertions, 387 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 | |||
@@ -14,8 +14,8 @@ if ( debugLevel < 3 ) \ | |||
14 | { \ | 14 | { \ |
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 | |||
@@ -5,8 +5,9 @@ | |||
5 | 5 | ||
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> |
12 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
@@ -16,48 +17,44 @@ | |||
16 | #include <qlabel.h> | 17 | #include <qlabel.h> |
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> |
23 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
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 | ||
30 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 33 | MainWindow::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 | ||
63 | void MainWindow::makeMenu() | 60 | void MainWindow::makeMenu() |
@@ -99,61 +96,57 @@ void MainWindow::makeMenu() | |||
99 | this , SLOT( updateList() ) ); | 96 | this , SLOT( updateList() ) ); |
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() ) ); |
132 | cfgact->addTo( cfgMenu ); | 125 | cfgact->addTo( cfgMenu ); |
133 | 126 | ||
134 | QAction *a; | 127 | QAction *a; |
135 | 128 | ||
136 | sectionBar = new QPEToolBar( this ); | 129 | sectionBar = new QPEToolBar( this ); |
137 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 130 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
138 | sectionBar->setHorizontalStretchable( true ); | 131 | sectionBar->setHorizontalStretchable( true ); |
139 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 132 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
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); |
159 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); | 152 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); |
@@ -164,32 +157,67 @@ void MainWindow::makeMenu() | |||
164 | findBar->setStretchableWidget( findEdit ); | 157 | findBar->setStretchableWidget( findEdit ); |
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 | ||
186 | MainWindow::~MainWindow() | 207 | MainWindow::~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 | ||
190 | void MainWindow::runIpkg() | 217 | void 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". |
195 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 223 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
@@ -199,40 +227,31 @@ void MainWindow::runIpkg() | |||
199 | } | 227 | } |
200 | 228 | ||
201 | void MainWindow::updateList() | 229 | void 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 | |||
215 | void 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 | ||
223 | void MainWindow::filterList() | 242 | void 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 | ||
232 | void MainWindow::displayList() | 251 | void 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(); |
238 | while( pack ) | 257 | while( pack ) |
@@ -325,8 +344,20 @@ void MainWindow::findClose() | |||
325 | { | 344 | { |
326 | findAction->setOn( false ); | 345 | findAction->setOn( false ); |
327 | } | 346 | } |
328 | 347 | ||
348 | void MainWindow::destShow(bool b) | ||
349 | { | ||
350 | if (b) destBar->show(); | ||
351 | else destBar->hide(); | ||
352 | destAction->setOn( b ); | ||
353 | } | ||
354 | |||
355 | void MainWindow::destClose() | ||
356 | { | ||
357 | destAction->setOn( false ); | ||
358 | } | ||
359 | |||
329 | void MainWindow::rotateUpdateIcon() | 360 | void MainWindow::rotateUpdateIcon() |
330 | { | 361 | { |
331 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 362 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
332 | if ( updateIcon ) | 363 | if ( updateIcon ) |
@@ -360,12 +391,32 @@ void MainWindow::installFile(const QString &fileName) | |||
360 | e << lf; | 391 | e << lf; |
361 | displayList(); | 392 | displayList(); |
362 | } | 393 | } |
363 | 394 | ||
395 | void 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 | |||
364 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 404 | void 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) ); |
370 | } | 410 | }else if( msg == "removeFile(QString)" ) |
371 | } \ No newline at end of file | 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") | ||
421 | } | ||
422 | } | ||
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 | |||
@@ -16,8 +16,9 @@ class QPEToolBar; | |||
16 | class QLineEdit; | 16 | class QLineEdit; |
17 | class PackageListItem; | 17 | class PackageListItem; |
18 | class QCopChannel; | 18 | class QCopChannel; |
19 | class QMessageBox; | 19 | class QMessageBox; |
20 | class QCheckBox; | ||
20 | 21 | ||
21 | class MainWindow : public QMainWindow | 22 | class MainWindow : public QMainWindow |
22 | { | 23 | { |
23 | Q_OBJECT | 24 | Q_OBJECT |
@@ -25,14 +26,14 @@ class MainWindow : public QMainWindow | |||
25 | 26 | ||
26 | public: | 27 | public: |
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 | ||
32 | protected slots: | 34 | protected 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(); |
38 | void sectionChanged(); | 39 | void sectionChanged(); |
@@ -44,8 +45,10 @@ public slots: | |||
44 | void sectionClose(); | 45 | void sectionClose(); |
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 &); |
51 | 54 | ||
@@ -59,19 +62,22 @@ private: | |||
59 | PmIpkg* ipkg; | 62 | PmIpkg* ipkg; |
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; | ||
74 | private slots: | 80 | private slots: |
75 | void rotateUpdateIcon(); | 81 | void rotateUpdateIcon(); |
76 | }; | 82 | }; |
77 | 83 | ||
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 | |||
@@ -4,14 +4,16 @@ TEMPLATE = app | |||
4 | CONFIG = qt warn_on debug | 4 | 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 \ |
17 | packagelistitem.cpp \ | 19 | packagelistitem.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 | |||
@@ -8,11 +8,11 @@ | |||
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | 9 | ||
10 | #include "debug.h" | 10 | #include "debug.h" |
11 | 11 | ||
12 | Package::~Package() | 12 | //Package::~Package() |
13 | { | 13 | //{ |
14 | } | 14 | //} |
15 | 15 | ||
16 | Package::Package( PackageManagerSettings *s ) | 16 | Package::Package( PackageManagerSettings *s ) |
17 | { | 17 | { |
18 | init(s); | 18 | init(s); |
@@ -60,67 +60,58 @@ Package::Package( Package *pi ) | |||
60 | 60 | ||
61 | 61 | ||
62 | void Package::setValue( QString n, QString t ) | 62 | void 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" ) | 68 | { |
70 | { | ||
71 | _size = t; | 69 | _size = t; |
72 | } | 70 | }else if ( n == "Priority") |
73 | if ( n == "Priority") | 71 | { |
74 | { | ||
75 | 72 | ||
76 | } | 73 | }else if ( n == "Section") |
77 | if ( n == "Section") | 74 | { |
78 | { | ||
79 | setSection( t ); | 75 | setSection( t ); |
80 | } | 76 | }else if ( n == "Maintainer") |
81 | if ( n == "Maintainer") | 77 | { |
82 | { | ||
83 | 78 | ||
84 | } | 79 | }else if ( n == "Architecture") |
85 | if ( n == "Architecture") | 80 | { |
86 | { | ||
87 | 81 | ||
88 | } | 82 | }else if ( n == "Version") |
89 | if ( n == "Version") | 83 | { |
90 | { | ||
91 | 84 | ||
92 | } | 85 | }else if ( n == "Pre-Depends") |
93 | if ( n == "Pre-Depends") | 86 | { |
94 | { | ||
95 | 87 | ||
96 | } | 88 | }else if ( n == "Depends") |
97 | if ( n == "Depends") | 89 | { |
98 | { | ||
99 | 90 | ||
100 | }else if ( n == "Filename") | 91 | }else if ( n == "Filename") |
101 | { | 92 | { |
102 | 93 | ||
103 | }else if ( n == "Size") | 94 | }else if ( n == "Size") |
104 | { | 95 | { |
105 | 96 | ||
106 | }else if ( n == "MD5Sum") | 97 | }else if ( n == "MD5Sum") |
107 | { | 98 | { |
108 | 99 | ||
109 | } | 100 | } |
110 | if ( n == "Description") | 101 | if ( n == "Description") |
111 | { | 102 | { |
112 | setDesc( t ); | 103 | setDesc( t ); |
113 | } | 104 | } |
114 | if ( n == "Status") | 105 | if ( n == "Status") |
115 | { | 106 | { |
116 | if ( installed() ) return; | 107 | if ( installed() ) return; |
117 | _status = t; | 108 | _status = t; |
118 | } | 109 | } |
119 | if ( t == "Essential") | 110 | if ( t == "Essential") |
120 | { | 111 | { |
121 | 112 | ||
122 | } | 113 | } |
123 | }; | 114 | }; |
124 | 115 | ||
125 | QString Package::name() | 116 | QString Package::name() |
126 | { | 117 | { |
@@ -152,8 +143,24 @@ QString Package::size() | |||
152 | { | 143 | { |
153 | return _size; | 144 | return _size; |
154 | } | 145 | } |
155 | 146 | ||
147 | QString 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 | |||
156 | bool Package::toProcess() | 163 | bool Package::toProcess() |
157 | { | 164 | { |
158 | return _toProcess; | 165 | return _toProcess; |
159 | } | 166 | } |
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 | |||
@@ -11,12 +11,12 @@ | |||
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | 12 | ||
13 | class Package //: public QObject | 13 | class Package //: public QObject |
14 | { | 14 | { |
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* ); |
22 | 22 | ||
@@ -29,8 +29,9 @@ class Package //: public QObject | |||
29 | void setDesc( QString ); | 29 | void setDesc( QString ); |
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(); |
36 | QString details(); | 37 | QString details(); |
@@ -44,9 +45,8 @@ class Package //: public QObject | |||
44 | bool link(); | 45 | bool link(); |
45 | void setLink(bool); | 46 | void setLink(bool); |
46 | void parseIpkgFile( QString );; | 47 | void parseIpkgFile( QString );; |
47 | public slots: | 48 | public slots: |
48 | /** No descriptions */ | ||
49 | QString getPackageName(); | 49 | QString getPackageName(); |
50 | void toggleProcess(); | 50 | void toggleProcess(); |
51 | 51 | ||
52 | private: | 52 | private: |
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 | |||
@@ -16,37 +16,22 @@ PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSetti | |||
16 | package = pi; | 16 | package = pi; |
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 | ||
51 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | 36 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, |
52 | int column, int width, int alignment ) | 37 | int column, int width, int alignment ) |
@@ -119,21 +104,19 @@ QString PackageListItem::key( int column, bool ascending ) const | |||
119 | void PackageListItem::setOn( bool b ) | 104 | 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 | ||
134 | void PackageListItem::displayDetails() | 112 | void 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(); |
139 | } | 122 | } |
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 | |||
@@ -26,8 +26,9 @@ public: | |||
26 | virtual void setOn ( bool ); | 26 | virtual void setOn ( bool ); |
27 | void displayDetails(); | 27 | void displayDetails(); |
28 | 28 | ||
29 | private: | 29 | private: |
30 | QCheckListItem *nameItem; | ||
30 | QCheckListItem *destItem; | 31 | QCheckListItem *destItem; |
31 | QCheckListItem *linkItem; | 32 | QCheckListItem *linkItem; |
32 | PackageManagerSettings *settings; | 33 | PackageManagerSettings *settings; |
33 | Package *package; | 34 | Package *package; |
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 | |||
@@ -51,9 +51,9 @@ void PackageListView::setCurrent( QListViewItem* p ) | |||
51 | { | 51 | { |
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 | ||
59 | 59 | ||
@@ -62,23 +62,33 @@ void PackageListView::showPopup() | |||
62 | popupMenu->clear(); | 62 | popupMenu->clear(); |
63 | destsMenu->clear(); | 63 | destsMenu->clear(); |
64 | 64 | ||
65 | QAction *popupAction; | 65 | QAction *popupAction; |
66 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); | 66 | if ( !activePackage->installed() ) |
67 | QStringList dests = settings->getDestinationNames(); | 67 | { |
68 | for (uint i = 0; i < dests.count(); i++ ) | 68 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); |
69 | { | 69 | QStringList dests = settings->getDestinationNames(); |
70 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | 70 | QString ad = settings->getDestinationName(); |
71 | popupAction->addTo( destsMenu ); | 71 | for (uint i = 0; i < dests.count(); i++ ) |
72 | } | 72 | { |
73 | connect( destsMenu, SIGNAL( activated( int ) ), | 73 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); |
74 | this, SLOT( changePackageDest( int ) ) ); | 74 | popupAction->addTo( destsMenu ); |
75 | if ( dests[i] == ad && activePackage->toInstall() ) | ||
76 | { | ||
77 | popupAction->setToggleAction( true ); | ||
78 | popupAction->setOn(true); | ||
79 | }; | ||
80 | } | ||
81 | connect( destsMenu, SIGNAL( activated( 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 | ||
78 | void PackageListView::stopTimer( QListViewItem* ) | 89 | void PackageListView::stopTimer( QListViewItem* ) |
79 | { | 90 | { |
80 | pvDebug( 5, "stop timer" ); | ||
81 | popupTimer->stop(); | 91 | popupTimer->stop(); |
82 | } | 92 | } |
83 | 93 | ||
84 | 94 | ||
@@ -88,4 +98,10 @@ void PackageListView::changePackageDest( int i ) | |||
88 | activePackage->setOn(); | 98 | activePackage->setOn(); |
89 | activePackage->setLink( settings->createLinks() ); | 99 | activePackage->setLink( settings->createLinks() ); |
90 | activePackageListItem->displayDetails(); | 100 | activePackageListItem->displayDetails(); |
91 | } | 101 | } |
102 | |||
103 | void 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 | |||
@@ -47,7 +47,9 @@ public slots: | |||
47 | void showPopup(); | 47 | void showPopup(); |
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 | |||
@@ -30,8 +30,9 @@ | |||
30 | 30 | ||
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 | ||
35 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) | 36 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) |
36 | : PackageManagerSettingsBase( parent, name, fl ) | 37 | : PackageManagerSettingsBase( parent, name, fl ) |
37 | { | 38 | { |
@@ -55,8 +56,9 @@ PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* na | |||
55 | destinationname->setEnabled(FALSE); | 56 | destinationname->setEnabled(FALSE); |
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 | ||
61 | PackageManagerSettings::~PackageManagerSettings() | 63 | PackageManagerSettings::~PackageManagerSettings() |
62 | { | 64 | { |
@@ -75,10 +77,12 @@ void PackageManagerSettings::newServer() | |||
75 | serverurlDic.insert(i,new QString(serverurl->text())); | 77 | serverurlDic.insert(i,new QString(serverurl->text())); |
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 | ||
83 | void PackageManagerSettings::newDestination() | 87 | void PackageManagerSettings::newDestination() |
84 | { | 88 | { |
@@ -96,8 +100,9 @@ void PackageManagerSettings::newDestination() | |||
96 | activeLinkDestination->insertItem(destinationname->text()); | 100 | activeLinkDestination->insertItem(destinationname->text()); |
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 | ||
103 | void PackageManagerSettings::editServer(int i) | 108 | void PackageManagerSettings::editServer(int i) |
@@ -116,8 +121,9 @@ void PackageManagerSettings::editServer(int i) | |||
116 | editedserver = i; | 121 | editedserver = 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 | ||
123 | void PackageManagerSettings::editDestination(int i) | 129 | void PackageManagerSettings::editDestination(int i) |
@@ -136,8 +142,9 @@ void PackageManagerSettings::editDestination(int i) | |||
136 | editeddestination = i; | 142 | editeddestination = 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 | ||
142 | void PackageManagerSettings::removeServer() | 149 | void PackageManagerSettings::removeServer() |
143 | { | 150 | { |
@@ -150,8 +157,9 @@ void PackageManagerSettings::removeServer() | |||
150 | activeServers->removeItem(editedserver); | 157 | activeServers->removeItem(editedserver); |
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 | ||
156 | void PackageManagerSettings::removeDestination() | 164 | void PackageManagerSettings::removeDestination() |
157 | { | 165 | { |
@@ -165,16 +173,19 @@ void PackageManagerSettings::removeDestination() | |||
165 | activeLinkDestination->removeItem(editeddestination); | 173 | activeLinkDestination->removeItem(editeddestination); |
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 | ||
171 | void PackageManagerSettings::serverNameChanged(const QString& t) | 180 | void PackageManagerSettings::serverNameChanged(const QString& t) |
172 | { | 181 | { |
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 | ||
179 | void PackageManagerSettings::destNameChanged(const QString& t) | 190 | void PackageManagerSettings::destNameChanged(const QString& t) |
180 | { | 191 | { |
@@ -182,18 +193,21 @@ void PackageManagerSettings::destNameChanged(const QString& t) | |||
182 | destinations->changeItem( t, editeddestination ); | 193 | destinations->changeItem( t, editeddestination ); |
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 | ||
188 | void PackageManagerSettings::serverUrlChanged(const QString& t) | 200 | void 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 | ||
193 | void PackageManagerSettings::destUrlChanged(const QString& t) | 206 | void 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 | ||
198 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) | 212 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) |
199 | { | 213 | { |
@@ -264,13 +278,13 @@ void PackageManagerSettings::installationSettingChange(int cs) | |||
264 | { | 278 | { |
265 | writeCurrentInstallationSetting(); | 279 | writeCurrentInstallationSetting(); |
266 | currentSetting = cs; | 280 | currentSetting = cs; |
267 | readInstallationSetting( cs ); | 281 | readInstallationSetting( cs ); |
282 | changed = true; | ||
268 | } | 283 | } |
269 | 284 | ||
270 | void PackageManagerSettings::writeInstallationSettings() | 285 | void 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" ); |
276 | cfg.writeEntry( "count", installationSettingsCount ); | 290 | cfg.writeEntry( "count", installationSettingsCount ); |
@@ -284,27 +298,25 @@ void PackageManagerSettings::readInstallationSetting(int setting) | |||
284 | { | 298 | { |
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 ) |
297 | activeDestination->setCurrentItem( i ); | 310 | activeDestination->setCurrentItem( i ); |
298 | if ( activeLinkDestination->text( i ) == linkdest ) | 311 | if ( activeLinkDestination->text( i ) == linkdest ) |
299 | activeLinkDestination->setCurrentItem( i ); | 312 | activeLinkDestination->setCurrentItem( i ); |
300 | } | 313 | } |
301 | } | 314 | } |
302 | 315 | ||
303 | void PackageManagerSettings::writeCurrentInstallationSetting() | 316 | void 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() ); |
310 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); | 322 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); |
@@ -331,8 +343,9 @@ void PackageManagerSettings::installationSettingSetName(const QString &name) | |||
331 | 343 | ||
332 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) | 344 | bool 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(); |
338 | activeServers->clear(); | 351 | activeServers->clear(); |
@@ -423,9 +436,9 @@ void PackageManagerSettings::readSettings() | |||
423 | } | 436 | } |
424 | 437 | ||
425 | void PackageManagerSettings::writeSettings() | 438 | void 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 */ |
431 | bool PackageManagerSettings::showDialog( int i ) | 444 | bool PackageManagerSettings::showDialog( int i ) |
@@ -434,9 +447,9 @@ bool PackageManagerSettings::showDialog( int i ) | |||
434 | showMaximized(); | 447 | showMaximized(); |
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 */ |
441 | QString PackageManagerSettings::getDestinationName() | 454 | QString PackageManagerSettings::getDestinationName() |
442 | { | 455 | { |
@@ -468,8 +481,17 @@ QStringList PackageManagerSettings::getActiveServers() | |||
468 | sl += activeServers->text(i); | 481 | sl += activeServers->text(i); |
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 */ |
474 | QStringList PackageManagerSettings::getDestinationUrls() | 496 | QStringList PackageManagerSettings::getDestinationUrls() |
475 | { | 497 | { |
@@ -505,7 +527,16 @@ QStringList PackageManagerSettings::getDestinationNames() | |||
505 | 527 | ||
506 | 528 | ||
507 | void PackageManagerSettings::linkEnabled( bool b ) | 529 | void PackageManagerSettings::linkEnabled( bool b ) |
508 | { | 530 | { |
509 | changed = true; | ||
510 | activeLinkDestination->setEnabled( b ); | 531 | activeLinkDestination->setEnabled( b ); |
511 | } | 532 | } |
533 | |||
534 | void PackageManagerSettings::activeServerChanged() | ||
535 | { | ||
536 | changed = true; | ||
537 | } | ||
538 | |||
539 | QComboBox* 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 | |||
@@ -16,12 +16,15 @@ public: | |||
16 | QString getDestinationUrl(); | 16 | QString getDestinationUrl(); |
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 | ||
25 | private: | 28 | private: |
26 | QIntDict<QString> serverurlDic; | 29 | QIntDict<QString> serverurlDic; |
27 | QIntDict<QString> destinationurlDic; | 30 | QIntDict<QString> destinationurlDic; |
@@ -58,7 +61,8 @@ public slots: | |||
58 | void installationSettingChange(int); | 61 | void installationSettingChange(int); |
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 | |||
@@ -10,9 +10,9 @@ | |||
10 | <name>geometry</name> | 10 | <name>geometry</name> |
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> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
@@ -175,9 +175,9 @@ | |||
175 | <cstring>CheckBoxLink</cstring> | 175 | <cstring>CheckBoxLink</cstring> |
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> |
183 | <class>QComboBox</class> | 183 | <class>QComboBox</class> |
@@ -717,8 +717,26 @@ | |||
717 | </widget> | 717 | </widget> |
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&)</slot> | 739 | <slot access="public">destNameChanged(const QString&)</slot> |
722 | <slot access="public">destUrlChanged(const QString&)</slot> | 740 | <slot access="public">destUrlChanged(const QString&)</slot> |
723 | <slot access="public">editDestination(int)</slot> | 741 | <slot access="public">editDestination(int)</slot> |
724 | <slot access="public">editServer(int)</slot> | 742 | <slot access="public">editServer(int)</slot> |
@@ -727,8 +745,9 @@ | |||
727 | <slot access="public">linkEnabled(bool)</slot> | 745 | <slot access="public">linkEnabled(bool)</slot> |
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> |
734 | <slot access="public">renameInstallationSetting()</slot> | 753 | <slot access="public">renameInstallationSetting()</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 | |||
@@ -8,8 +8,9 @@ | |||
8 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
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> |
15 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
@@ -56,10 +57,17 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
56 | cmd += " -dest "+ dest; | 57 | cmd += " -dest "+ 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; |
65 | int r = 0; | 73 | int r = 0; |
@@ -75,16 +83,14 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
75 | out( "running:<br>\n"+cmd+"<br>\n" ); | 83 | out( "running:<br>\n"+cmd+"<br>\n" ); |
76 | QString redirect = "/tmp/oipkg.pipe"; | 84 | QString redirect = "/tmp/oipkg.pipe"; |
77 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; | 85 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; |
78 | pvDebug(2, "running >"+cmd+"<"); | 86 | pvDebug(2, "running >"+cmd+"<"); |
79 | r = system(cmd.latin1()); | 87 | r = system(cmd.latin1()); |
80 | QFile f( redirect ); | 88 | QFile f( redirect ); |
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(); |
90 | if ( line != oldLine ) | 96 | if ( line != oldLine ) |
@@ -92,9 +98,8 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
92 | out( line +"<br>" ); | 98 | out( line +"<br>" ); |
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 |
100 | 105 | ||
@@ -103,70 +108,106 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
103 | 108 | ||
104 | void PmIpkg::makeLinks(Package *pack) | 109 | void 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 | |||
115 | QStringList* 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 ); | 126 | QFile f( packFileName ); |
116 | } | 127 | if ( ! f.open(IO_ReadOnly) ) |
117 | |||
118 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | ||
119 | { | ||
120 | QFile f( packFileName ); | ||
121 | 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 | ||
142 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | ||
143 | { | ||
144 | QStringList *fileList = getList( packFileName, dest ); | ||
145 | processFileList( fileList, dest ); | ||
146 | delete fileList; | ||
147 | } | ||
148 | |||
149 | void 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 | |||
138 | void PmIpkg::processLinkDir( QString file, QString dest ) | 161 | void 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; |
145 | QFileInfo fileInfo( file ); | 170 | QFileInfo fileInfo( file ); |
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(); |
153 | QFileInfoListIterator it( *list ); | 178 | QFileInfoListIterator it( *list ); |
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 | { |
168 | symlink( instFile, linkFile ); | 198 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
199 | symlink( instFile, linkFile ); | ||
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 | } | ||
169 | } | 210 | } |
170 | } | 211 | } |
171 | 212 | ||
172 | void PmIpkg::commit( PackageList pl ) | 213 | void PmIpkg::commit( PackageList pl ) |
@@ -175,9 +216,8 @@ void PmIpkg::commit( PackageList pl ) | |||
175 | to_install.clear(); | 216 | to_install.clear(); |
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) |
183 | { | 223 | { |
@@ -206,133 +246,147 @@ void PmIpkg::startDialog() | |||
206 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); | 246 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); |
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 | ||
272 | void PmIpkg::doIt() | 307 | void PmIpkg::doIt() |
273 | { | 308 | { |
309 | show( true ); | ||
274 | remove(); | 310 | remove(); |
275 | install(); | 311 | install(); |
276 | } | 312 | } |
277 | 313 | ||
278 | 314 | ||
279 | void PmIpkg::remove() | 315 | void 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() ); |
292 | it->processed(); | 328 | linkOpp = removeLink; |
293 | runwindow->progress->setProgress( 1 ); | 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 | } | ||
335 | it->processed(); | ||
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 | ||
301 | void PmIpkg::install() | 347 | void 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 | ||
322 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) | 373 | void 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()) ) { | 382 | void 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 | ||
337 | void PmIpkg::update() | 391 | void PmIpkg::update() |
338 | { | 392 | { |
@@ -342,9 +396,11 @@ void PmIpkg::update() | |||
342 | } | 396 | } |
343 | 397 | ||
344 | void PmIpkg::out( QString o ) | 398 | void 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 | ||
350 | 406 | ||
@@ -375,14 +431,30 @@ void PmIpkg::show(bool b) | |||
375 | else | 431 | else |
376 | runwindow->progress->show(); | 432 | runwindow->progress->show(); |
377 | } | 433 | } |
378 | 434 | ||
379 | void PmIpkg::installFile(const QString &fileName) | 435 | void 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 | |||
448 | void 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 | |||
@@ -10,43 +10,55 @@ | |||
10 | #include "runwindow.h" | 10 | #include "runwindow.h" |
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 | |||
14 | class Package; | 17 | class Package; |
15 | class PmIpkg : public QObject | 18 | class PmIpkg : public QObject |
16 | { | 19 | { |
17 | Q_OBJECT | 20 | Q_OBJECT |
18 | public: | 21 | 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 | ||
32 | public 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 | |||
28 | private: | 41 | private: |
29 | PackageManagerSettings* settings; | 42 | PackageManagerSettings* settings; |
30 | RunWindow *runwindow; | 43 | RunWindow *runwindow; |
31 | QDialog *installDialog; | 44 | QDialog *installDialog; |
32 | QList<Package> to_remove; | 45 | QList<Package> to_remove; |
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 | ||
44 | public 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 | |||
@@ -433,4 +433,9 @@ QStringList PackageManagerSettings::getDestinationUrls() | |||
433 | void PackageManagerSettings::linkEnabled( bool b ) | 433 | void PackageManagerSettings::linkEnabled( bool b ) |
434 | { | 434 | { |
435 | activeLinkDestination->setEnabled( b ); | 435 | activeLinkDestination->setEnabled( b ); |
436 | } | 436 | } |
437 | |||
438 | void 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 | |||
@@ -20,30 +20,15 @@ public: | |||
20 | bool createLinks(); | 20 | bool createLinks(); |
21 | QStringList getActiveServers(); | 21 | QStringList getActiveServers(); |
22 | QStringList getDestinationUrls(); | 22 | QStringList getDestinationUrls(); |
23 | 23 | ||
24 | private: | ||
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 | |||
39 | public slots: | 24 | public 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(); |
49 | void newDestination(); | 34 | void newDestination(); |
@@ -57,7 +42,22 @@ public slots: | |||
57 | void installationSettingChange(int); | 42 | void installationSettingChange(int); |
58 | void newInstallationSetting(); | 43 | void newInstallationSetting(); |
59 | void removeInstallationSetting(); | 44 | void removeInstallationSetting(); |
60 | void renameInstallationSetting(); | 45 | void renameInstallationSetting(); |
46 | |||
47 | private: | ||
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 | |||
22 | void 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 | |||
18 | void setComboName( QComboBox*, QString ); \ No newline at end of file | ||