summaryrefslogtreecommitdiff
authortille <tille>2002-05-01 22:01:28 (UTC)
committer tille <tille>2002-05-01 22:01:28 (UTC)
commit82ff405e40d4aa6cad8b5583f9d7e5b89a78f261 (patch) (unidiff)
treeee246a1d25ec191538963597c15e7eb88897309a
parentda12e60078563ef6e10ddcc1edeb931f765b8b6d (diff)
downloadopie-82ff405e40d4aa6cad8b5583f9d7e5b89a78f261.zip
opie-82ff405e40d4aa6cad8b5583f9d7e5b89a78f261.tar.gz
opie-82ff405e40d4aa6cad8b5583f9d7e5b89a78f261.tar.bz2
fixed: remove only from std dest
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO3
-rw-r--r--noncore/unsupported/oipkg/opie-oipkg.control2
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp2
3 files changed, 4 insertions, 3 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO
index 9d9a650..1aa9e6b 100644
--- a/noncore/unsupported/oipkg/TODO
+++ b/noncore/unsupported/oipkg/TODO
@@ -1,13 +1,14 @@
1* Settings Class 1* Settings Class
2* tr() ;) 2* tr() ;)
3* Dialog to display ipkg output live 3* Dialog to display ipkg output live
4* parse "to install" and "to remove" from status 4* parse "to install" and "to remove" from status
5* install local file dialog 5* install local file dialog
6* qcop 6* qcop
7* error handling 7* error handling
8* manage links 8* manage links
9* dependency checking 9* dependency checking
10* create dest if it does not exist 10* create dest if it does not exist
11* allow reinstalling 11* allow reinstalling
12* different types of filters and searches 12* different types of filters and searches
13 i.e. name, desc, files etc \ No newline at end of file 13 i.e. name, desc, files etc
14* get packages from doclnk \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/opie-oipkg.control b/noncore/unsupported/oipkg/opie-oipkg.control
index 2d2b63c..1cff44e 100644
--- a/noncore/unsupported/oipkg/opie-oipkg.control
+++ b/noncore/unsupported/oipkg/opie-oipkg.control
@@ -1,9 +1,9 @@
1Files: bin/oipkg apps/Settings/oipkg.desktop pics/oipkg/ 1Files: bin/oipkg apps/Settings/oipkg.desktop pics/oipkg/*
2Priority: optional 2Priority: optional
3Section: opie/settings 3Section: opie/settings
4Maintainer: Patrick S. Vogt <tille@almana.ch> 4Maintainer: Patrick S. Vogt <tille@almana.ch>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION), ipkg (>0.9) 7Depends: opie-base ($QPE_VERSION), ipkg (>0.9)
8Description: Opie Projects advanced gui ipkg installer 8Description: Opie Projects advanced gui ipkg installer
9 A GUI front-end to ipkg for the Opie environment. 9 A GUI front-end to ipkg for the Opie environment.
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 1798c80..2559a51 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,448 +1,448 @@
1#include "pmipkg.h" 1#include "pmipkg.h"
2#include "pksettings.h" 2#include "pksettings.h"
3#include "package.h" 3#include "package.h"
4#include "packagelistitem.h" 4#include "packagelistitem.h"
5 5
6#include <qpe/process.h> 6#include <qpe/process.h>
7#include <qpe/resource.h> 7#include <qpe/resource.h>
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 <qgroupbox.h>
13#include <qmultilineedit.h> 13#include <qmultilineedit.h>
14#include <qstring.h> 14#include <qstring.h>
15#include <qcheckbox.h> 15#include <qcheckbox.h>
16#include <qtextstream.h> 16#include <qtextstream.h>
17#include <qtextview.h> 17#include <qtextview.h>
18 18
19#include <qprogressbar.h> 19#include <qprogressbar.h>
20#include <qpushbutton.h> 20#include <qpushbutton.h>
21#include <qlayout.h> 21#include <qlayout.h>
22 22
23#include <stdlib.h> 23#include <stdlib.h>
24#include <unistd.h> 24#include <unistd.h>
25 25
26#include "mainwindow.h" 26#include "mainwindow.h"
27 27
28 28
29PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 29PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
30 : QObject ( p ) 30 : QObject ( p )
31{ 31{
32 settings = s; 32 settings = s;
33 runwindowopen = false; 33 runwindowopen = false;
34 runwindow = new RunWindow( p, name, true, f ); 34 runwindow = new RunWindow( p, name, true, f );
35} 35}
36 36
37PmIpkg::~PmIpkg() 37PmIpkg::~PmIpkg()
38{ 38{
39} 39}
40 40
41//#define PROC 41//#define PROC
42#define SYSTEM 42#define SYSTEM
43int PmIpkg::runIpkg(const QString& args, const QString& dest ) 43int PmIpkg::runIpkg(const QString& args, const QString& dest )
44{ 44{
45 pvDebug(2,"PmIpkg::runIpkg "+args); 45 pvDebug(2,"PmIpkg::runIpkg "+args);
46 46
47#ifdef PROC 47#ifdef PROC
48 QStringList cmd = "/usr/bin/ipkg "; 48 QStringList cmd = "/usr/bin/ipkg ";
49#endif 49#endif
50#ifdef SYSTEM 50#ifdef SYSTEM
51 QString cmd = "/usr/bin/ipkg "; 51 QString cmd = "/usr/bin/ipkg ";
52#endif 52#endif
53 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 53 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
54 if ( dest == "" ) 54 if ( dest == "" )
55 cmd += " -dest "+settings->getDestinationName(); 55 cmd += " -dest "+settings->getDestinationName();
56 else 56 else
57 cmd += " -dest "+ dest; 57 cmd += " -dest "+ dest;
58 58
59 cmd += " -force-defaults "; 59 cmd += " -force-defaults ";
60 60
61 if (_force_depends) 61 if (_force_depends)
62 { 62 {
63 if (_force_depends->isChecked()) 63 if (_force_depends->isChecked())
64 cmd += " -force-depends "; 64 cmd += " -force-depends ";
65 if (_force_reinstall->isChecked()) 65 if (_force_reinstall->isChecked())
66 cmd += " -force-reinstall "; 66 cmd += " -force-reinstall ";
67 if (_force_remove->isChecked()) 67 if (_force_remove->isChecked())
68 cmd += " -force-removal-of-essential-packages "; 68 cmd += " -force-removal-of-essential-packages ";
69 } 69 }
70 70
71 out( "<hr><br>Starting to "+ args+"<br>\n"); 71 out( "<hr><br>Starting to "+ args+"<br>\n");
72 cmd += args; 72 cmd += args;
73 int r = 0; 73 int r = 0;
74#ifdef PROC 74#ifdef PROC
75 QString o = "start"; 75 QString o = "start";
76 Process *ipkg = new Process( "ls");//cmd ); 76 Process *ipkg = new Process( "ls");//cmd );
77 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); 77 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
78 QString description; 78 QString description;
79 ipkg->exec("",o); 79 ipkg->exec("",o);
80// out( o ); 80// out( o );
81#endif 81#endif
82#ifdef SYSTEM 82#ifdef SYSTEM
83 out( "running:<br>\n"+cmd+"<br>\n" ); 83 out( "running:<br>\n"+cmd+"<br>\n" );
84 QString redirect = "/tmp/oipkg.pipe"; 84 QString redirect = "/tmp/oipkg.pipe";
85 cmd += " 2>&1 | tee "+redirect+" 2>&1"; 85 cmd += " 2>&1 | tee "+redirect+" 2>&1";
86 pvDebug(2, "running >"+cmd+"<"); 86 pvDebug(2, "running >"+cmd+"<");
87 r = system(cmd.latin1()); 87 r = system(cmd.latin1());
88 QFile f( redirect ); 88 QFile f( redirect );
89 QString line; 89 QString line;
90 QString oldLine; 90 QString oldLine;
91 while ( ! f.open(IO_ReadOnly) ) {}; 91 while ( ! f.open(IO_ReadOnly) ) {};
92 QTextStream t( &f ); 92 QTextStream t( &f );
93 while ( !t.eof() ) 93 while ( !t.eof() )
94 { 94 {
95 line = t.readLine(); 95 line = t.readLine();
96 if ( line != oldLine ) 96 if ( line != oldLine )
97 { 97 {
98 out( line +"<br>" ); 98 out( line +"<br>" );
99 oldLine = line; 99 oldLine = line;
100 } 100 }
101 } 101 }
102 f.close(); 102 f.close();
103 out( "Finished!<br>"); 103 out( "Finished!<br>");
104#endif 104#endif
105 105
106 return r; 106 return r;
107} 107}
108 108
109void PmIpkg::makeLinks(Package *pack) 109void PmIpkg::makeLinks(Package *pack)
110{ 110{
111 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 111 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
112 linkPackage( pack->name(), pack->dest() ); 112 linkPackage( pack->name(), pack->dest() );
113} 113}
114 114
115QStringList* PmIpkg::getList( QString packFileName, QString d ) 115QStringList* PmIpkg::getList( QString packFileName, QString d )
116{ 116{
117 QString dest = settings->getDestinationUrlByName( d ); 117 QString dest = settings->getDestinationUrlByName( d );
118 dest = dest==""?d:dest; 118 dest = dest==""?d:dest;
119 if (dest == "/" ) return 0; 119 if (dest == "/" ) return 0;
120 { 120 {
121 Config cfg( "oipkg", Config::User ); 121 Config cfg( "oipkg", Config::User );
122 cfg.setGroup( "Common" ); 122 cfg.setGroup( "Common" );
123 QString statusDir = cfg.readEntry( "statusDir", "" ); 123 QString statusDir = cfg.readEntry( "statusDir", "" );
124 } 124 }
125 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; 125 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list";
126 QFile f( packFileName ); 126 QFile f( packFileName );
127 if ( ! f.open(IO_ReadOnly) ) 127 if ( ! f.open(IO_ReadOnly) )
128 { 128 {
129 pvDebug(1," Panik! Could not open"); 129 pvDebug(1," Panik! Could not open");
130 out( "<b>Panik!</b> Could not open:<br>"+packFileName ); 130 out( "<b>Panik!</b> Could not open:<br>"+packFileName );
131 return (QStringList*)0; 131 return (QStringList*)0;
132 } 132 }
133 QStringList *fileList = new QStringList(); 133 QStringList *fileList = new QStringList();
134 QTextStream t( &f ); 134 QTextStream t( &f );
135 while ( !t.eof() ) 135 while ( !t.eof() )
136 { 136 {
137 *fileList += t.readLine(); 137 *fileList += t.readLine();
138 } 138 }
139 return fileList; 139 return fileList;
140} 140}
141 141
142void PmIpkg::linkPackage( QString packFileName, QString dest ) 142void PmIpkg::linkPackage( QString packFileName, QString dest )
143{ 143{
144 QStringList *fileList = getList( packFileName, dest ); 144 QStringList *fileList = getList( packFileName, dest );
145 processFileList( fileList, dest ); 145 processFileList( fileList, dest );
146 delete fileList; 146 delete fileList;
147} 147}
148 148
149void PmIpkg::processFileList( QStringList *fileList, QString d ) 149void PmIpkg::processFileList( QStringList *fileList, QString d )
150{ 150{
151 if (!fileList) return; 151 if (!fileList) return;
152 for (uint i=0; i < fileList->count(); i++) 152 for (uint i=0; i < fileList->count(); i++)
153 { 153 {
154 QString dest = settings->getDestinationUrlByName( d ); 154 QString dest = settings->getDestinationUrlByName( d );
155 dest = dest==""?d:dest; 155 dest = dest==""?d:dest;
156 processLinkDir( (*fileList)[i], dest ); 156 processLinkDir( (*fileList)[i], dest );
157 } 157 }
158} 158}
159 159
160 160
161void PmIpkg::processLinkDir( QString file, QString dest ) 161void PmIpkg::processLinkDir( QString file, QString dest )
162{ 162{
163 pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); 163 pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest);
164 if (linkOpp==createLink) pvDebug( 2,"opp: createLink"); 164 if (linkOpp==createLink) pvDebug( 2,"opp: createLink");
165 if (linkOpp==removeLink) pvDebug( 2,"opp:removeLink"); 165 if (linkOpp==removeLink) pvDebug( 2,"opp:removeLink");
166 if ( dest == "???" || dest == "" ) return; 166 if ( dest == "???" || dest == "" ) return;
167 QString destFile = file; 167 QString destFile = file;
168 file = dest+"/"+file; 168 file = dest+"/"+file;
169 if (file == dest) return; 169 if (file == dest) return;
170 QFileInfo fileInfo( file ); 170 QFileInfo fileInfo( file );
171 if ( fileInfo.isDir() ) 171 if ( fileInfo.isDir() )
172 { 172 {
173 QDir destDir( destFile ); 173 QDir destDir( destFile );
174 if (linkOpp==createLink) destDir.mkdir( destFile, true ); 174 if (linkOpp==createLink) destDir.mkdir( destFile, true );
175 QDir d( file ); 175 QDir d( file );
176 d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 176 d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
177 const QFileInfoList *list = d.entryInfoList(); 177 const QFileInfoList *list = d.entryInfoList();
178 QFileInfoListIterator it( *list ); 178 QFileInfoListIterator it( *list );
179 QFileInfo *fi; 179 QFileInfo *fi;
180 while ( (fi=it.current()) ) 180 while ( (fi=it.current()) )
181 { 181 {
182 pvDebug(4, "process dir "+fi->absFilePath()); 182 pvDebug(4, "process dir "+fi->absFilePath());
183 processLinkDir( fi->absFilePath(), dest ); 183 processLinkDir( fi->absFilePath(), dest );
184 ++it; 184 ++it;
185 } 185 }
186// if (linkOpp==removeLink) 186// if (linkOpp==removeLink)
187// { 187// {
188 // pvDebug(2,"remove destDir "+ destFile ); 188 // pvDebug(2,"remove destDir "+ destFile );
189 // destDir.remove( destFile, true ); 189 // destDir.remove( destFile, true );
190// } 190// }
191 } else 191 } else
192 if ( fileInfo.isFile() ) 192 if ( fileInfo.isFile() )
193 { 193 {
194 const char *instFile = strdup( (file).ascii() ); 194 const char *instFile = strdup( (file).ascii() );
195 const char *linkFile = strdup( (destFile).ascii()); 195 const char *linkFile = strdup( (destFile).ascii());
196 if( linkOpp==createLink ) 196 if( linkOpp==createLink )
197 { 197 {
198 pvDebug(4, "linking: "+file+" -> "+destFile ); 198 pvDebug(4, "linking: "+file+" -> "+destFile );
199 symlink( instFile, linkFile ); 199 symlink( instFile, linkFile );
200 } 200 }
201 } else { 201 } else {
202 const char *linkFile = strdup( (destFile).ascii()); 202 const char *linkFile = strdup( (destFile).ascii());
203 if( linkOpp==removeLink ) 203 if( linkOpp==removeLink )
204 { 204 {
205 pvDebug(4,"removing "+destFile+" no "+file); 205 pvDebug(4,"removing "+destFile+" no "+file);
206 QFileInfo toRemoveLink( destFile ); 206 QFileInfo toRemoveLink( destFile );
207 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 207 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
208 unlink( linkFile ); 208 unlink( linkFile );
209 } 209 }
210 } 210 }
211} 211}
212 212
213void PmIpkg::loadList( PackageList pl ) 213void PmIpkg::loadList( PackageList pl )
214 { 214 {
215 for( Package *pack = pl.first();pack ; (pack = pl.next()) ) 215 for( Package *pack = pl.first();pack ; (pack = pl.next()) )
216 { 216 {
217 if ( pack && (pack->name() != "") && pack) 217 if ( pack && (pack->name() != "") && pack)
218 { 218 {
219 if ( pack->toInstall() ) 219 if ( pack->toInstall() )
220 to_install.append( pack ); 220 to_install.append( pack );
221 if ( pack->toRemove() ) 221 if ( pack->toRemove() )
222 to_remove.append( pack ); 222 to_remove.append( pack );
223 } 223 }
224 } 224 }
225} 225}
226 226
227void PmIpkg::commit( PackageList pl ) 227void PmIpkg::commit( PackageList pl )
228 { 228 {
229 sizecount = 0; 229 sizecount = 0;
230 QString rem="<b>"+tr("To remove:")+"</b><br>\n"; 230 QString rem="<b>"+tr("To remove:")+"</b><br>\n";
231 QString inst="<b>"+tr("To install:")+"</b><br>\n"; 231 QString inst="<b>"+tr("To install:")+"</b><br>\n";
232 loadList(pl); 232 loadList(pl);
233 for (uint i=0; i < to_remove.count(); i++) 233 for (uint i=0; i < to_remove.count(); i++)
234 sizecount += 1; 234 sizecount += 1;
235 for (uint i=0; i < to_install.count(); i++) 235 for (uint i=0; i < to_install.count(); i++)
236 sizecount += to_install.at(i)->size().toInt(); 236 sizecount += to_install.at(i)->size().toInt();
237 startDialog(); 237 startDialog();
238} 238}
239 239
240void PmIpkg::startDialog() 240void PmIpkg::startDialog()
241{ 241{
242 installDialog = new QDialog(0,0,true); 242 installDialog = new QDialog(0,0,true);
243 QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); 243 QGridLayout *RunWindowLayout = new QGridLayout( installDialog );
244 RunWindowLayout->setSpacing( 2 ); 244 RunWindowLayout->setSpacing( 2 );
245 RunWindowLayout->setMargin( 2 ); 245 RunWindowLayout->setMargin( 2 );
246 246
247 PackageListView *plv = new PackageListView(installDialog, "install",settings); 247 PackageListView *plv = new PackageListView(installDialog, "install",settings);
248 plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); 248 plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) );
249 RunWindowLayout->addWidget( plv, 1, 0 ); 249 RunWindowLayout->addWidget( plv, 1, 0 );
250 QCheckListItem *toRemoveItem; 250 QCheckListItem *toRemoveItem;
251 toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); 251 toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") );
252 toRemoveItem->setOpen( true ); 252 toRemoveItem->setOpen( true );
253 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 253 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
254 { 254 {
255 toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); 255 toRemoveItem->insertItem( new PackageListItem(plv, it,settings) );
256 } 256 }
257 QCheckListItem *toInstallItem; 257 QCheckListItem *toInstallItem;
258 toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); 258 toInstallItem = new QCheckListItem( plv, QObject::tr("To install") );
259 toInstallItem->setOpen( true ); 259 toInstallItem->setOpen( true );
260 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 260 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
261 { 261 {
262 toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); 262 toInstallItem->insertItem( new PackageListItem(plv, it,settings) );
263 } 263 }
264 264
265 QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); 265 QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" );
266 GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) ); 266 GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) );
267 GroupBox1->setTitle( tr( "Ipkg options" ) ); 267 GroupBox1->setTitle( tr( "Ipkg options" ) );
268 GroupBox1->setColumnLayout(0, Qt::Vertical ); 268 GroupBox1->setColumnLayout(0, Qt::Vertical );
269 GroupBox1->layout()->setSpacing( 0 ); 269 GroupBox1->layout()->setSpacing( 0 );
270 GroupBox1->layout()->setMargin( 0 ); 270 GroupBox1->layout()->setMargin( 0 );
271 QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); 271 QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
272 GroupBox1Layout->setAlignment( Qt::AlignTop ); 272 GroupBox1Layout->setAlignment( Qt::AlignTop );
273 GroupBox1Layout->setSpacing( 3 ); 273 GroupBox1Layout->setSpacing( 3 );
274 GroupBox1Layout->setMargin( 3 ); 274 GroupBox1Layout->setMargin( 3 );
275 _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); 275 _force_depends = new QCheckBox( GroupBox1, "_force_depends" );
276 _force_depends->setText( tr( "-force-depends" ) ); 276 _force_depends->setText( tr( "-force-depends" ) );
277 _force_depends->setAutoResize( TRUE ); 277 _force_depends->setAutoResize( TRUE );
278 _force_depends->setChecked(true); 278 _force_depends->setChecked(true);
279 GroupBox1Layout->addWidget( _force_depends, 0, 0 ); 279 GroupBox1Layout->addWidget( _force_depends, 0, 0 );
280 _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); 280 _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" );
281 _force_reinstall->setText( tr( "-force-reinstall" ) ); 281 _force_reinstall->setText( tr( "-force-reinstall" ) );
282 _force_reinstall->setAutoResize( TRUE ); 282 _force_reinstall->setAutoResize( TRUE );
283 GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); 283 GroupBox1Layout->addWidget( _force_reinstall, 1, 0 );
284 _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); 284 _force_remove = new QCheckBox( GroupBox1, "_force_remove" );
285 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); 285 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
286 _force_remove->setAutoResize( TRUE ); 286 _force_remove->setAutoResize( TRUE );
287 GroupBox1Layout->addWidget( _force_remove, 1, 0 ); 287 GroupBox1Layout->addWidget( _force_remove, 1, 0 );
288 RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); 288 RunWindowLayout->addWidget( GroupBox1 , 3, 0 );
289 installDialog->showMaximized(); 289 installDialog->showMaximized();
290 if ( installDialog->exec() ) doIt(); 290 if ( installDialog->exec() ) doIt();
291 installDialog->close(); 291 installDialog->close();
292 out(tr("<b>All done.</b>")); 292 out(tr("<b>All done.</b>"));
293} 293}
294 294
295void PmIpkg::doIt() 295void PmIpkg::doIt()
296{ 296{
297 show( true ); 297 show( true );
298 remove(); 298 remove();
299 install(); 299 install();
300} 300}
301 301
302 302
303void PmIpkg::remove() 303void PmIpkg::remove()
304{ 304{
305 if ( to_remove.count() == 0 ) return; 305 if ( to_remove.count() == 0 ) return;
306 306
307 out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); 307 out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>");
308 308
309 QStringList *fileList; 309 QStringList *fileList;
310 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 310 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
311 { 311 {
312 if ( it->link() )fileList = getList( it->name(), it->dest() ); 312 if ( it->link() )fileList = getList( it->name(), it->dest() );
313 if ( runIpkg("remove " + it->name()) == 0) 313 if ( runIpkg("remove " + it->name(), it->dest() ) == 0)
314 { 314 {
315 runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); 315 runwindow->progress->setProgress( 1 + runwindow->progress->progress() );
316 linkOpp = removeLink; 316 linkOpp = removeLink;
317 if ( it->link() ) 317 if ( it->link() )
318 { 318 {
319 out( "<br>removing links<br>" ); 319 out( "<br>removing links<br>" );
320 out( "for package "+it->name()+" in "+it->dest()+"<br>" ); 320 out( "for package "+it->name()+" in "+it->dest()+"<br>" );
321 processFileList( fileList, it->dest() ); 321 processFileList( fileList, it->dest() );
322 } 322 }
323 it->processed(); 323 it->processed();
324 324
325 out("<br><hr>"); 325 out("<br><hr>");
326 }else{ 326 }else{
327 out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); 327 out("<b>"+tr("Error while removing")+"</b><hr>"+it->name());
328 } 328 }
329 if ( it->link() )delete fileList; 329 if ( it->link() )delete fileList;
330 } 330 }
331 out("<br>"); 331 out("<br>");
332} 332}
333 333
334 334
335void PmIpkg::install() 335void PmIpkg::install()
336{ 336{
337 if ( to_install.count() == 0 ) return; 337 if ( to_install.count() == 0 ) return;
338 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); 338 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
339 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 339 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
340 { 340 {
341 341
342 if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) 342 if ( runIpkg("install " + it->installName(), it->dest() ) == 0 )
343 { 343 {
344 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 344 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
345 linkOpp = createLink; 345 linkOpp = createLink;
346 if ( it->link() ) 346 if ( it->link() )
347 { 347 {
348 out( "<br>creating links<br>" ); 348 out( "<br>creating links<br>" );
349 out( "for package "+it->name()+" in "+it->dest()+"<br>" ); 349 out( "for package "+it->name()+" in "+it->dest()+"<br>" );
350 makeLinks( it ); 350 makeLinks( it );
351 } 351 }
352 it->processed(); 352 it->processed();
353 out("<br><hr>"); 353 out("<br><hr>");
354 }else{ 354 }else{
355 out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); 355 out("<b>"+tr("Error while installing")+"</b><hr>"+it->name());
356 } 356 }
357 } 357 }
358 out("<br>"); 358 out("<br>");
359} 359}
360 360
361void PmIpkg::createLinks( const QString &dest ) 361void PmIpkg::createLinks( const QString &dest )
362{ 362{
363 pvDebug(2,"PmIpkg::createLinks "+dest); 363 pvDebug(2,"PmIpkg::createLinks "+dest);
364 linkOpp=createLink; 364 linkOpp=createLink;
365 QString url = settings->getDestinationUrlByName( dest ); 365 QString url = settings->getDestinationUrlByName( dest );
366 url = url==""?dest:url; 366 url = url==""?dest:url;
367 processLinkDir( "/", url ); 367 processLinkDir( "/", url );
368} 368}
369 369
370void PmIpkg::removeLinks( const QString &dest ) 370void PmIpkg::removeLinks( const QString &dest )
371{ 371{
372 pvDebug(2,"PmIpkg::removeLinks "+dest); 372 pvDebug(2,"PmIpkg::removeLinks "+dest);
373 linkOpp=removeLink; 373 linkOpp=removeLink;
374 QString url = settings->getDestinationUrlByName( dest ); 374 QString url = settings->getDestinationUrlByName( dest );
375 url = url==""?dest:url; 375 url = url==""?dest:url;
376 processLinkDir( "/", url ); 376 processLinkDir( "/", url );
377} 377}
378 378
379void PmIpkg::update() 379void PmIpkg::update()
380{ 380{
381 show( false ); 381 show( false );
382 runIpkg( "update" ); 382 runIpkg( "update" );
383 runwindow->close(); 383 runwindow->close();
384} 384}
385 385
386void PmIpkg::out( QString o ) 386void PmIpkg::out( QString o )
387{ 387{
388 runwindow->outPut->append(o); 388 runwindow->outPut->append(o);
389 //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); 389 //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight());
390 //runwindow->outPut->setText( runwindow->outPut->text()+o ); 390 //runwindow->outPut->setText( runwindow->outPut->text()+o );
391 runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); 391 runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight());
392} 392}
393 393
394 394
395void PmIpkg::showButtons(bool b) 395void PmIpkg::showButtons(bool b)
396{ 396{
397 if ( b ) 397 if ( b )
398 { 398 {
399 runwindow->cancelButton->hide(); 399 runwindow->cancelButton->hide();
400 runwindow->doItButton->hide(); 400 runwindow->doItButton->hide();
401 runwindow->removeButton->hide(); 401 runwindow->removeButton->hide();
402 runwindow->installButton->hide(); 402 runwindow->installButton->hide();
403 }else{ 403 }else{
404 runwindow->cancelButton->show(); 404 runwindow->cancelButton->show();
405 runwindow->doItButton->show(); 405 runwindow->doItButton->show();
406 runwindow->removeButton->show(); 406 runwindow->removeButton->show();
407 runwindow->installButton->show(); 407 runwindow->installButton->show();
408 408
409 } 409 }
410} 410}
411 411
412void PmIpkg::show(bool b) 412void PmIpkg::show(bool b)
413{ 413{
414 if (!runwindow->isVisible()) 414 if (!runwindow->isVisible())
415 runwindow->showMaximized(); 415 runwindow->showMaximized();
416 showButtons(b); 416 showButtons(b);
417 if ( !b ) 417 if ( !b )
418 runwindow->progress->hide(); 418 runwindow->progress->hide();
419 else 419 else
420 runwindow->progress->show(); 420 runwindow->progress->show();
421} 421}
422 422
423void PmIpkg::installFile(const QString &fileName, const QString &dest) 423void PmIpkg::installFile(const QString &fileName, const QString &dest)
424{ 424{
425 425
426 to_install.clear(); 426 to_install.clear();
427 to_remove.clear(); 427 to_remove.clear();
428 pvDebug( 2,"PmIpkg::installFile "+ fileName); 428 pvDebug( 2,"PmIpkg::installFile "+ fileName);
429 Package *p = new Package(fileName,settings); 429 Package *p = new Package(fileName,settings);
430 if ( dest!="") p->setDest( dest ); 430 if ( dest!="") p->setDest( dest );
431 to_install.append( p ); 431 to_install.append( p );
432 startDialog(); 432 startDialog();
433 delete p; 433 delete p;
434} 434}
435 435
436void PmIpkg::removeFile(const QString &fileName, const QString &dest) 436void PmIpkg::removeFile(const QString &fileName, const QString &dest)
437{ 437{
438 438
439 to_install.clear(); 439 to_install.clear();
440 to_remove.clear(); 440 to_remove.clear();
441 pvDebug( 2,"PmIpkg::removeFile "+ fileName); 441 pvDebug( 2,"PmIpkg::removeFile "+ fileName);
442 Package *p = new Package(fileName,settings); 442 Package *p = new Package(fileName,settings);
443 if ( dest!="") p->setDest( dest ); 443 if ( dest!="") p->setDest( dest );
444 to_remove.append( p ); 444 to_remove.append( p );
445 startDialog(); 445 startDialog();
446 delete p; 446 delete p;
447} 447}
448 448