summaryrefslogtreecommitdiff
authorleseb <leseb>2002-06-21 09:19:18 (UTC)
committer leseb <leseb>2002-06-21 09:19:18 (UTC)
commitda8fdc855382e3b6e945aa1aeb429e5737e0792d (patch) (unidiff)
treea0656e9abf0131822c6fa01e70151ae47cad4e61
parentb5c57220c9a7b685418c8e8e0e02906659dd8b47 (diff)
downloadopie-da8fdc855382e3b6e945aa1aeb429e5737e0792d.zip
opie-da8fdc855382e3b6e945aa1aeb429e5737e0792d.tar.gz
opie-da8fdc855382e3b6e945aa1aeb429e5737e0792d.tar.bz2
Missing EOL
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp2
-rw-r--r--noncore/unsupported/oipkg/utils.cpp2
-rw-r--r--noncore/unsupported/oipkg/utils.h2
4 files changed, 3 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 11ab406..233eae6 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -1,459 +1,458 @@
1// adadpted form qpe/qipkg 1// adadpted form qpe/qipkg
2 2
3 3
4#include "mainwindow.h" 4#include "mainwindow.h"
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/config.h>
10#include <qpe/qpetoolbar.h> 10#include <qpe/qpetoolbar.h>
11#include <qpe/qcopenvelope_qws.h> 11#include <qpe/qcopenvelope_qws.h>
12#include <qaction.h> 12#include <qaction.h>
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14#include <qpopupmenu.h> 14#include <qpopupmenu.h>
15#include <qtoolbutton.h> 15#include <qtoolbutton.h>
16#include <qstring.h> 16#include <qstring.h>
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qfile.h> 18#include <qfile.h>
19#include <qlistview.h> 19#include <qlistview.h>
20#include <qtextview.h> 20#include <qtextview.h>
21#include <qcheckbox.h> 21#include <qcheckbox.h>
22#include <qlineedit.h> 22#include <qlineedit.h>
23#include <qtabwidget.h> 23#include <qtabwidget.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28 28
29#include "pksettingsbase.h" 29#include "pksettingsbase.h"
30#include "utils.h" 30#include "utils.h"
31#include "packagelistitem.h" 31#include "packagelistitem.h"
32 32
33 33
34MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : 34MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
35 QMainWindow( parent, name, f ) 35 QMainWindow( parent, name, f )
36// packageListServers( QObject(parent), name ), 36// packageListServers( QObject(parent), name ),
37// packageListSearch( parent, name ), 37// packageListSearch( parent, name ),
38// packageListDocLnk( parent, name ) 38// packageListDocLnk( parent, name )
39 { 39 {
40 setCaption( tr("Package Manager") ); 40 setCaption( tr("Package Manager") );
41 settings = new PackageManagerSettings(this,0,TRUE); 41 settings = new PackageManagerSettings(this,0,TRUE);
42 listViewPackages = new PackageListView( this,"listViewPackages",settings ); 42 listViewPackages = new PackageListView( this,"listViewPackages",settings );
43 setCentralWidget( listViewPackages ); 43 setCentralWidget( listViewPackages );
44 listViewPackages->addList( tr("feeds"), &packageListServers ); 44 listViewPackages->addList( tr("feeds"), &packageListServers );
45 listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); 45 listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
46 listViewPackages->addList( tr("documents"), &packageListDocLnk ); 46 listViewPackages->addList( tr("documents"), &packageListDocLnk );
47 ipkg = new PmIpkg( settings, this ); 47 ipkg = new PmIpkg( settings, this );
48 packageListServers.setSettings( settings ); 48 packageListServers.setSettings( settings );
49 packageListSearch.setSettings( settings ); 49 packageListSearch.setSettings( settings );
50 packageListDocLnk.setSettings( settings ); 50 packageListDocLnk.setSettings( settings );
51 pvDebug(9,"packageListServers.update"); 51 pvDebug(9,"packageListServers.update");
52 packageListServers.update(); 52 packageListServers.update();
53 pvDebug(9,"packageListDocLnk.update"); 53 pvDebug(9,"packageListDocLnk.update");
54 packageListDocLnk.update(); 54 packageListDocLnk.update();
55 pvDebug(9,"makeMenu"); 55 pvDebug(9,"makeMenu");
56 makeMenu(); 56 makeMenu();
57 makeChannel(); 57 makeChannel();
58 //opie is hardcoded default ;) 58 //opie is hardcoded default ;)
59 //pvDebug(9,"section->setCurrentItem"); 59 //pvDebug(9,"section->setCurrentItem");
60// for (int i=0;i<section->count();i++) 60// for (int i=0;i<section->count();i++)
61 // if (section->text(i)=="opie") 61 // if (section->text(i)=="opie")
62 // section->setCurrentItem(i); 62 // section->setCurrentItem(i);
63// sectionChanged(); 63// sectionChanged();
64 64
65 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 65 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
66 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 66 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
67 67
68 connect( settings->removeLinksButton, SIGNAL( clicked()), 68 connect( settings->removeLinksButton, SIGNAL( clicked()),
69 SLOT(removeLinks()) ); 69 SLOT(removeLinks()) );
70 connect( settings->createLinksButton, SIGNAL( clicked()), 70 connect( settings->createLinksButton, SIGNAL( clicked()),
71 SLOT(createLinks()) ); 71 SLOT(createLinks()) );
72 72
73 pvDebug(9,"displayList"); 73 pvDebug(9,"displayList");
74 displayList(); 74 displayList();
75} 75}
76 76
77void MainWindow::makeMenu() 77void MainWindow::makeMenu()
78{ 78{
79 79
80 QPEToolBar *toolBar = new QPEToolBar( this ); 80 QPEToolBar *toolBar = new QPEToolBar( this );
81 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 81 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
82 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 82 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
83 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 83 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
84 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 84 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
85 // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); 85 // QPopupMenu *sectMenu = new QPopupMenu( menuBar );
86 86
87 setToolBarsMovable( false ); 87 setToolBarsMovable( false );
88 toolBar->setHorizontalStretchable( true ); 88 toolBar->setHorizontalStretchable( true );
89 menuBar->insertItem( tr( "Package" ), srvMenu ); 89 menuBar->insertItem( tr( "Package" ), srvMenu );
90 menuBar->insertItem( tr( "View" ), viewMenu ); 90 menuBar->insertItem( tr( "View" ), viewMenu );
91 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 91 menuBar->insertItem( tr( "Settings" ), cfgMenu );
92 // menuBar->insertItem( tr( "Sections" ), sectMenu ); 92 // menuBar->insertItem( tr( "Sections" ), sectMenu );
93 93
94 QLabel *spacer; 94 QLabel *spacer;
95// spacer = new QLabel( "", toolBar ); 95// spacer = new QLabel( "", toolBar );
96// spacer->setBackgroundColor( toolBar->backgroundColor() ); 96// spacer->setBackgroundColor( toolBar->backgroundColor() );
97// toolBar->setStretchableWidget( spacer ); 97// toolBar->setStretchableWidget( spacer );
98 98
99 99
100 runAction = new QAction( tr( "Apply" ), 100 runAction = new QAction( tr( "Apply" ),
101 Resource::loadPixmap( "oipkg/install" ), 101 Resource::loadPixmap( "oipkg/install" ),
102 QString::null, 0, this, 0 ); 102 QString::null, 0, this, 0 );
103 connect( runAction, SIGNAL( activated() ), 103 connect( runAction, SIGNAL( activated() ),
104 this, SLOT( runIpkg() ) ); 104 this, SLOT( runIpkg() ) );
105 runAction->addTo( toolBar ); 105 runAction->addTo( toolBar );
106 runAction->addTo( srvMenu ); 106 runAction->addTo( srvMenu );
107 107
108 srvMenu->insertSeparator (); 108 srvMenu->insertSeparator ();
109 109
110 updateAction = new QAction( tr( "Update" ), 110 updateAction = new QAction( tr( "Update" ),
111 Resource::loadIconSet( "oipkg/update" ), 111 Resource::loadIconSet( "oipkg/update" ),
112 QString::null, 0, this, 0 ); 112 QString::null, 0, this, 0 );
113 connect( updateAction, SIGNAL( activated() ), 113 connect( updateAction, SIGNAL( activated() ),
114 this , SLOT( updateList() ) ); 114 this , SLOT( updateList() ) );
115 updateAction->addTo( toolBar ); 115 updateAction->addTo( toolBar );
116 updateAction->addTo( srvMenu ); 116 updateAction->addTo( srvMenu );
117 117
118 QAction *cfgact; 118 QAction *cfgact;
119 119
120 cfgact = new QAction( tr( "Setups" ), 120 cfgact = new QAction( tr( "Setups" ),
121 QString::null, 0, this, 0 ); 121 QString::null, 0, this, 0 );
122 connect( cfgact, SIGNAL( activated() ), 122 connect( cfgact, SIGNAL( activated() ),
123 SLOT( showSettings() ) ); 123 SLOT( showSettings() ) );
124 cfgact->addTo( cfgMenu ); 124 cfgact->addTo( cfgMenu );
125 125
126 cfgact = new QAction( tr( "Servers" ), 126 cfgact = new QAction( tr( "Servers" ),
127 QString::null, 0, this, 0 ); 127 QString::null, 0, this, 0 );
128 connect( cfgact, SIGNAL( activated() ), 128 connect( cfgact, SIGNAL( activated() ),
129 SLOT( showSettingsSrv() ) ); 129 SLOT( showSettingsSrv() ) );
130 cfgact->addTo( cfgMenu ); 130 cfgact->addTo( cfgMenu );
131 cfgact = new QAction( tr( "Destinations" ), 131 cfgact = new QAction( tr( "Destinations" ),
132 QString::null, 0, this, 0 ); 132 QString::null, 0, this, 0 );
133 connect( cfgact, SIGNAL( activated() ), 133 connect( cfgact, SIGNAL( activated() ),
134 SLOT( showSettingsDst() ) ); 134 SLOT( showSettingsDst() ) );
135 cfgact->addTo( cfgMenu ); 135 cfgact->addTo( cfgMenu );
136 136
137 QAction *a; 137 QAction *a;
138 138
139 // SECTIONS 139 // SECTIONS
140 sectionBar = new QPEToolBar( this ); 140 sectionBar = new QPEToolBar( this );
141 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); 141 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
142 sectionBar->setHorizontalStretchable( true ); 142 sectionBar->setHorizontalStretchable( true );
143 QLabel *label = new QLabel( tr("Section: "), sectionBar ); 143 QLabel *label = new QLabel( tr("Section: "), sectionBar );
144 label->setBackgroundColor( sectionBar->backgroundColor() ); 144 label->setBackgroundColor( sectionBar->backgroundColor() );
145 section = new QComboBox( false, sectionBar ); 145 section = new QComboBox( false, sectionBar );
146 label = new QLabel( " / ", sectionBar ); 146 label = new QLabel( " / ", sectionBar );
147 label->setBackgroundColor( sectionBar->backgroundColor() ); 147 label->setBackgroundColor( sectionBar->backgroundColor() );
148 subsection = new QComboBox( false, sectionBar ); 148 subsection = new QComboBox( false, sectionBar );
149 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 149 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
150 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 150 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
151 a->addTo( sectionBar ); 151 a->addTo( sectionBar );
152 setSections(); 152 setSections();
153 setSubSections(); 153 setSubSections();
154 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 154 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
155 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 155 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
156 sectionAction->setToggleAction( true ); 156 sectionAction->setToggleAction( true );
157 sectionAction->addTo( viewMenu ); 157 sectionAction->addTo( viewMenu );
158 sectionBar->setStretchableWidget( section ); 158 sectionBar->setStretchableWidget( section );
159 159
160 //FIND 160 //FIND
161 findBar = new QPEToolBar(this); 161 findBar = new QPEToolBar(this);
162 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); 162 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
163 label = new QLabel( tr("Filter: "), findBar ); 163 label = new QLabel( tr("Filter: "), findBar );
164 label->setBackgroundColor( findBar->backgroundColor() ); 164 label->setBackgroundColor( findBar->backgroundColor() );
165 findBar->setHorizontalStretchable( TRUE ); 165 findBar->setHorizontalStretchable( TRUE );
166 findEdit = new QLineEdit( findBar, "findEdit" ); 166 findEdit = new QLineEdit( findBar, "findEdit" );
167 findBar->setStretchableWidget( findEdit ); 167 findBar->setStretchableWidget( findEdit );
168 connect( findEdit, SIGNAL( textChanged( const QString & ) ), 168 connect( findEdit, SIGNAL( textChanged( const QString & ) ),
169 this, SLOT( displayList() ) ); 169 this, SLOT( displayList() ) );
170 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 170 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
171 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); 171 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
172 a->addTo( findBar ); 172 a->addTo( findBar );
173 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 173 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
174 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 174 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
175 a->addTo( findBar ); 175 a->addTo( findBar );
176 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); 176 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
177 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 177 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
178 findAction->setToggleAction( true ); 178 findAction->setToggleAction( true );
179 findAction->addTo( viewMenu ); 179 findAction->addTo( viewMenu );
180 180
181 //SEARCH 181 //SEARCH
182 searchBar = new QPEToolBar(this); 182 searchBar = new QPEToolBar(this);
183 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 183 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
184 label = new QLabel( tr("ipkgfind: "), searchBar ); 184 label = new QLabel( tr("ipkgfind: "), searchBar );
185 label->setBackgroundColor( searchBar->backgroundColor() ); 185 label->setBackgroundColor( searchBar->backgroundColor() );
186 searchBar->setHorizontalStretchable( TRUE ); 186 searchBar->setHorizontalStretchable( TRUE );
187 searchEdit = new QLineEdit( searchBar, "seachEdit" ); 187 searchEdit = new QLineEdit( searchBar, "seachEdit" );
188 searchBar->setStretchableWidget( searchEdit ); 188 searchBar->setStretchableWidget( searchEdit );
189// connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 189// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
190// this, SLOT( displayList() ) ); 190// this, SLOT( displayList() ) );
191 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 191 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
192 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); 192 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
193 a->addTo( searchBar ); 193 a->addTo( searchBar );
194 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 194 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
195 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); 195 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
196 searchCommit->addTo( searchBar ); 196 searchCommit->addTo( searchBar );
197 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 197 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
198 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); 198 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
199 a->addTo( searchBar ); 199 a->addTo( searchBar );
200 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); 200 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
201 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); 201 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
202 searchAction->setToggleAction( true ); 202 searchAction->setToggleAction( true );
203 searchAction->addTo( viewMenu ); 203 searchAction->addTo( viewMenu );
204 204
205 //DEST 205 //DEST
206 destBar = new QPEToolBar(this); 206 destBar = new QPEToolBar(this);
207 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); 207 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
208 label = new QLabel( tr("Destination: "), destBar ); 208 label = new QLabel( tr("Destination: "), destBar );
209 label->setBackgroundColor( destBar->backgroundColor() ); 209 label->setBackgroundColor( destBar->backgroundColor() );
210 destBar->setHorizontalStretchable( TRUE ); 210 destBar->setHorizontalStretchable( TRUE );
211 destination = new QComboBox( false, destBar ); 211 destination = new QComboBox( false, destBar );
212 destination->insertStringList( settings->getDestinationNames() ); 212 destination->insertStringList( settings->getDestinationNames() );
213 setComboName(destination,settings->getDestinationName()); 213 setComboName(destination,settings->getDestinationName());
214 connect( destination, SIGNAL(activated(int)), 214 connect( destination, SIGNAL(activated(int)),
215 settings, SLOT(activeDestinationChange(int)) ); 215 settings, SLOT(activeDestinationChange(int)) );
216 spacer = new QLabel( " ", destBar ); 216 spacer = new QLabel( " ", destBar );
217 spacer->setBackgroundColor( destBar->backgroundColor() ); 217 spacer->setBackgroundColor( destBar->backgroundColor() );
218 CheckBoxLink = new QCheckBox( tr("Link"), destBar); 218 CheckBoxLink = new QCheckBox( tr("Link"), destBar);
219 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); 219 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() );
220 CheckBoxLink->setChecked( settings->createLinks() ); 220 CheckBoxLink->setChecked( settings->createLinks() );
221 connect( CheckBoxLink, SIGNAL(toggled(bool)), 221 connect( CheckBoxLink, SIGNAL(toggled(bool)),
222 settings, SLOT(linkEnabled(bool)) ); 222 settings, SLOT(linkEnabled(bool)) );
223 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); 223 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
224 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); 224 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
225 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 225 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
226 connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); 226 connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
227 a->addTo( destBar ); 227 a->addTo( destBar );
228 destBar->setStretchableWidget( CheckBoxLink ); 228 destBar->setStretchableWidget( CheckBoxLink );
229 destAction->setToggleAction( true ); 229 destAction->setToggleAction( true );
230 // destAction->addTo( viewMenu ); 230 // destAction->addTo( viewMenu );
231 231
232 // configure the menus 232 // configure the menus
233 Config cfg( "oipkg", Config::User ); 233 Config cfg( "oipkg", Config::User );
234 cfg.setGroup( "gui" ); 234 cfg.setGroup( "gui" );
235 235
236 findShow( cfg.readBoolEntry( "findBar", true ) ); 236 findShow( cfg.readBoolEntry( "findBar", true ) );
237 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 237 searchShow( cfg.readBoolEntry( "searchBar", true ) );
238 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 238 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
239 destShow( cfg.readBoolEntry( "destBar", false ) ); 239 destShow( cfg.readBoolEntry( "destBar", false ) );
240} 240}
241 241
242MainWindow::~MainWindow() 242MainWindow::~MainWindow()
243{ 243{
244 Config cfg( "oipkg", Config::User ); 244 Config cfg( "oipkg", Config::User );
245 cfg.setGroup( "gui" ); 245 cfg.setGroup( "gui" );
246 cfg.writeEntry( "findBar", !findBar->isHidden() ); 246 cfg.writeEntry( "findBar", !findBar->isHidden() );
247 cfg.writeEntry( "searchBar", !searchBar->isHidden() ); 247 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
248 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 248 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
249 cfg.writeEntry( "destBar", !destBar->isHidden() ); 249 cfg.writeEntry( "destBar", !destBar->isHidden() );
250 250
251} 251}
252 252
253void MainWindow::runIpkg() 253void MainWindow::runIpkg()
254{ 254{
255 packageListServers.allPackages(); 255 packageListServers.allPackages();
256 ipkg->loadList( &packageListSearch ); 256 ipkg->loadList( &packageListSearch );
257 ipkg->loadList( &packageListDocLnk ); 257 ipkg->loadList( &packageListDocLnk );
258 ipkg->loadList( &packageListServers ); 258 ipkg->loadList( &packageListServers );
259 ipkg->commit(); 259 ipkg->commit();
260 ipkg->clearLists(); 260 ipkg->clearLists();
261 // ##### If we looked in the list of files, we could send out accurate 261 // ##### If we looked in the list of files, we could send out accurate
262 // ##### messages. But we don't bother yet, and just do an "all". 262 // ##### messages. But we don't bother yet, and just do an "all".
263 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 263 QCopEnvelope e("QPE/System", "linkChanged(QString)");
264 QString lf = QString::null; 264 QString lf = QString::null;
265 e << lf; 265 e << lf;
266 displayList(); 266 displayList();
267} 267}
268 268
269void MainWindow::updateList() 269void MainWindow::updateList()
270{ 270{
271 packageListServers.clear(); 271 packageListServers.clear();
272 packageListSearch.clear(); 272 packageListSearch.clear();
273 packageListDocLnk.clear(); 273 packageListDocLnk.clear();
274 ipkg->update(); 274 ipkg->update();
275 packageListServers.update(); 275 packageListServers.update();
276 packageListSearch.update(); 276 packageListSearch.update();
277 packageListDocLnk.update(); 277 packageListDocLnk.update();
278} 278}
279 279
280void MainWindow::filterList() 280void MainWindow::filterList()
281{ 281{
282 QString f = ""; 282 QString f = "";
283 if ( findAction->isOn() ) f = findEdit->text(); 283 if ( findAction->isOn() ) f = findEdit->text();
284 packageListServers.filterPackages( f ); 284 packageListServers.filterPackages( f );
285} 285}
286 286
287void MainWindow::displayList() 287void MainWindow::displayList()
288{ 288{
289 filterList(); 289 filterList();
290 listViewPackages->display(); 290 listViewPackages->display();
291} 291}
292 292
293void MainWindow::sectionChanged() 293void MainWindow::sectionChanged()
294{ 294{
295 disconnect( section, SIGNAL( activated(int) ), 295 disconnect( section, SIGNAL( activated(int) ),
296 this, SLOT( sectionChanged() ) ); 296 this, SLOT( sectionChanged() ) );
297 disconnect( subsection, SIGNAL(activated(int) ), 297 disconnect( subsection, SIGNAL(activated(int) ),
298 this, SLOT( subSectionChanged() ) ); 298 this, SLOT( subSectionChanged() ) );
299 subsection->clear(); 299 subsection->clear();
300 packageListServers.setSection( section->currentText() ); 300 packageListServers.setSection( section->currentText() );
301 setSubSections(); 301 setSubSections();
302 connect( section, SIGNAL( activated(int) ), 302 connect( section, SIGNAL( activated(int) ),
303 this, SLOT( sectionChanged() ) ); 303 this, SLOT( sectionChanged() ) );
304 connect( subsection, SIGNAL(activated(int) ), 304 connect( subsection, SIGNAL(activated(int) ),
305 this, SLOT( subSectionChanged() ) ); 305 this, SLOT( subSectionChanged() ) );
306 displayList(); 306 displayList();
307} 307}
308 308
309void MainWindow::subSectionChanged() 309void MainWindow::subSectionChanged()
310{ 310{
311 disconnect( section, SIGNAL( activated(int) ), 311 disconnect( section, SIGNAL( activated(int) ),
312 this, SLOT( sectionChanged() ) ); 312 this, SLOT( sectionChanged() ) );
313 disconnect( subsection, SIGNAL(activated(int) ), 313 disconnect( subsection, SIGNAL(activated(int) ),
314 this, SLOT( subSectionChanged() ) ); 314 this, SLOT( subSectionChanged() ) );
315 packageListServers.setSubSection( subsection->currentText() ); 315 packageListServers.setSubSection( subsection->currentText() );
316 connect( section, SIGNAL( activated(int) ), 316 connect( section, SIGNAL( activated(int) ),
317 this, SLOT( sectionChanged() ) ); 317 this, SLOT( sectionChanged() ) );
318 connect( subsection, SIGNAL(activated(int) ), 318 connect( subsection, SIGNAL(activated(int) ),
319 this, SLOT( subSectionChanged() ) ); 319 this, SLOT( subSectionChanged() ) );
320 displayList(); 320 displayList();
321} 321}
322 322
323void MainWindow::setSections() 323void MainWindow::setSections()
324{ 324{
325 section->clear(); 325 section->clear();
326 section->insertStringList( packageListServers.getSections() ); 326 section->insertStringList( packageListServers.getSections() );
327} 327}
328 328
329void MainWindow::setSubSections() 329void MainWindow::setSubSections()
330{ 330{
331 subsection->clear(); 331 subsection->clear();
332 subsection->insertStringList( packageListServers.getSubSections() ); 332 subsection->insertStringList( packageListServers.getSubSections() );
333} 333}
334 334
335 335
336void MainWindow::showSettings() 336void MainWindow::showSettings()
337{ 337{
338 if ( settings->showDialog( 0 ) ) 338 if ( settings->showDialog( 0 ) )
339 updateList(); 339 updateList();
340} 340}
341void MainWindow::showSettingsSrv() 341void MainWindow::showSettingsSrv()
342{ 342{
343 if ( settings->showDialog( 1 ) ) 343 if ( settings->showDialog( 1 ) )
344 updateList(); 344 updateList();
345} 345}
346void MainWindow::showSettingsDst() 346void MainWindow::showSettingsDst()
347{ 347{
348 if ( settings->showDialog( 2 ) ) 348 if ( settings->showDialog( 2 ) )
349 updateList(); 349 updateList();
350} 350}
351 351
352void MainWindow::sectionShow(bool b) 352void MainWindow::sectionShow(bool b)
353{ 353{
354 if (b) sectionBar->show(); 354 if (b) sectionBar->show();
355 else sectionBar->hide(); 355 else sectionBar->hide();
356 sectionAction->setOn( b ); 356 sectionAction->setOn( b );
357} 357}
358 358
359void MainWindow::sectionClose() 359void MainWindow::sectionClose()
360{ 360{
361 sectionAction->setOn( false ); 361 sectionAction->setOn( false );
362} 362}
363 363
364void MainWindow::findShow(bool b) 364void MainWindow::findShow(bool b)
365{ 365{
366 if (b) findBar->show(); 366 if (b) findBar->show();
367 else findBar->hide(); 367 else findBar->hide();
368 findAction->setOn( b ); 368 findAction->setOn( b );
369} 369}
370 370
371void MainWindow::findClose() 371void MainWindow::findClose()
372{ 372{
373 findAction->setOn( false ); 373 findAction->setOn( false );
374} 374}
375 375
376void MainWindow::searchShow(bool b) 376void MainWindow::searchShow(bool b)
377{ 377{
378 if (b) searchBar->show(); 378 if (b) searchBar->show();
379 else searchBar->hide(); 379 else searchBar->hide();
380 searchAction->setOn( b ); 380 searchAction->setOn( b );
381} 381}
382 382
383void MainWindow::searchClose() 383void MainWindow::searchClose()
384{ 384{
385 searchAction->setOn( false ); 385 searchAction->setOn( false );
386} 386}
387 387
388 388
389void MainWindow::destShow(bool b) 389void MainWindow::destShow(bool b)
390{ 390{
391 if (b) destBar->show(); 391 if (b) destBar->show();
392 else destBar->hide(); 392 else destBar->hide();
393 destAction->setOn( b ); 393 destAction->setOn( b );
394} 394}
395 395
396void MainWindow::destClose() 396void MainWindow::destClose()
397{ 397{
398 destAction->setOn( false ); 398 destAction->setOn( false );
399} 399}
400 400
401void MainWindow::setDocument(const QString &fileName) 401void MainWindow::setDocument(const QString &fileName)
402{ 402{
403 if ( !QFile::exists( fileName ) ) return; 403 if ( !QFile::exists( fileName ) ) return;
404 ipkg->installFile( fileName ); 404 ipkg->installFile( fileName );
405 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 405 QCopEnvelope e("QPE/System", "linkChanged(QString)");
406 QString lf = QString::null; 406 QString lf = QString::null;
407 e << lf; 407 e << lf;
408 exit;
409} 408}
410 409
411 410
412void MainWindow::makeChannel() 411void MainWindow::makeChannel()
413 { 412 {
414 channel = new QCopChannel( "QPE/Application/oipkg", this ); 413 channel = new QCopChannel( "QPE/Application/oipkg", this );
415 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 414 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
416 this, SLOT(receive(const QCString&, const QByteArray&)) ); 415 this, SLOT(receive(const QCString&, const QByteArray&)) );
417} 416}
418 417
419 418
420 419
421void MainWindow::receive(const QCString &msg, const QByteArray &arg) 420void MainWindow::receive(const QCString &msg, const QByteArray &arg)
422{ 421{
423 pvDebug(3, "QCop "+msg+" "+QCString(arg)); 422 pvDebug(3, "QCop "+msg+" "+QCString(arg));
424 if ( msg == "installFile(QString)" ) 423 if ( msg == "installFile(QString)" )
425 { 424 {
426 ipkg->installFile( QString(arg) ); 425 ipkg->installFile( QString(arg) );
427 }else if( msg == "removeFile(QString)" ) 426 }else if( msg == "removeFile(QString)" )
428 { 427 {
429 ipkg->removeFile( QString(arg) ); 428 ipkg->removeFile( QString(arg) );
430 }else if( msg == "createLinks(QString)" ) 429 }else if( msg == "createLinks(QString)" )
431 { 430 {
432 ipkg->createLinks( QString(arg) ); 431 ipkg->createLinks( QString(arg) );
433 }else if( msg == "removeLinks(QString)" ) 432 }else if( msg == "removeLinks(QString)" )
434 { 433 {
435 ipkg->removeLinks( QString(arg) ); 434 ipkg->removeLinks( QString(arg) );
436 }else{ 435 }else{
437 pvDebug(2,"Huh what do ya want") 436 pvDebug(2,"Huh what do ya want")
438 } 437 }
439} 438}
440 439
441 440
442void MainWindow::createLinks() 441void MainWindow::createLinks()
443{ 442{
444 pvDebug(2,"creating links..."); 443 pvDebug(2,"creating links...");
445 ipkg->createLinks( settings->destinationurl->text() ); 444 ipkg->createLinks( settings->destinationurl->text() );
446} 445}
447 446
448void MainWindow::removeLinks() 447void MainWindow::removeLinks()
449{ 448{
450 pvDebug(2,"removing links..."); 449 pvDebug(2,"removing links...");
451 ipkg->removeLinks( settings->destinationurl->text() ); 450 ipkg->removeLinks( settings->destinationurl->text() );
452} 451}
453 452
454void MainWindow::remotePackageQuery() 453void MainWindow::remotePackageQuery()
455{ 454{
456 packageListSearch.query( searchEdit->text() ); 455 packageListSearch.query( searchEdit->text() );
457 packageListSearch.update(); 456 packageListSearch.update();
458 displayList(); 457 displayList();
459} 458}
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 2a534d2..0817247 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,466 +1,466 @@
1#include "pmipkg.h" 1#include "pmipkg.h"
2#include "pksettings.h" 2#include "pksettings.h"
3#include "package.h" 3#include "package.h"
4#include "packagelistitem.h" 4#include "packagelistitem.h"
5 5
6//#infdef OPROCESS 6//#infdef OPROCESS
7#include <opie/oprocess.h> 7#include <opie/oprocess.h>
8//#endif 8//#endif
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10#include <qpe/config.h> 10#include <qpe/config.h>
11#include <qpe/stringutil.h> 11#include <qpe/stringutil.h>
12#include <qpe/qpeapplication.h> 12#include <qpe/qpeapplication.h>
13#include <qdir.h> 13#include <qdir.h>
14#include <qfile.h> 14#include <qfile.h>
15#include <qgroupbox.h> 15#include <qgroupbox.h>
16#include <qmultilineedit.h> 16#include <qmultilineedit.h>
17#include <qstring.h> 17#include <qstring.h>
18#include <qcheckbox.h> 18#include <qcheckbox.h>
19#include <qtextstream.h> 19#include <qtextstream.h>
20#include <qtextview.h> 20#include <qtextview.h>
21 21
22#include <qprogressbar.h> 22#include <qprogressbar.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qlayout.h> 24#include <qlayout.h>
25 25
26#include <stdlib.h> 26#include <stdlib.h>
27#include <unistd.h> 27#include <unistd.h>
28 28
29#include "mainwindow.h" 29#include "mainwindow.h"
30 30
31 31
32PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 32PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
33 : QObject ( p ) 33 : QObject ( p )
34{ 34{
35 settings = s; 35 settings = s;
36 runwindow = new RunWindow( p, name, true, f ); 36 runwindow = new RunWindow( p, name, true, f );
37#ifdef OPROCESS 37#ifdef OPROCESS
38 ipkgProcess = new OProcess(); 38 ipkgProcess = new OProcess();
39 connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), 39 connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)),
40 this, SLOT(getIpkgOutput(OProcess*,char*,int))); 40 this, SLOT(getIpkgOutput(OProcess*,char*,int)));
41 41
42 connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), 42 connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)),
43 this, SLOT(getIpkgOutput(OProcess*,char*,int))); 43 this, SLOT(getIpkgOutput(OProcess*,char*,int)));
44 installDialog = 0; 44 installDialog = 0;
45#endif 45#endif
46} 46}
47 47
48PmIpkg::~PmIpkg() 48PmIpkg::~PmIpkg()
49{ 49{
50#ifdef OPROCESS 50#ifdef OPROCESS
51 delete ipkgProcess; 51 delete ipkgProcess;
52#endif 52#endif
53} 53}
54 54
55bool PmIpkg::runIpkg(const QString& args, const QString& dest ) 55bool PmIpkg::runIpkg(const QString& args, const QString& dest )
56{ 56{
57 bool ret=false; 57 bool ret=false;
58 QDir::setCurrent("/tmp"); 58 QDir::setCurrent("/tmp");
59 QString cmd = "/usr/bin/ipkg "; 59 QString cmd = "/usr/bin/ipkg ";
60#ifdef OPROCESS 60#ifdef OPROCESS
61 ipkgProcess->clearArguments(); 61 ipkgProcess->clearArguments();
62 *ipkgProcess << "/usr/bin/ipkg "; 62 *ipkgProcess << "/usr/bin/ipkg ";
63 QString cmd = ""; 63 QString cmd = "";
64#endif 64#endif
65 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 65 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
66 if ( dest == "" ) 66 if ( dest == "" )
67 cmd += " -dest "+settings->getDestinationName(); 67 cmd += " -dest "+settings->getDestinationName();
68 else 68 else
69 cmd += " -dest "+ dest; 69 cmd += " -dest "+ dest;
70 70
71 cmd += " -force-defaults "; 71 cmd += " -force-defaults ";
72 72
73 if (installDialog && installDialog->_force_depends) 73 if (installDialog && installDialog->_force_depends)
74 { 74 {
75 if (installDialog->_force_depends->isChecked()) 75 if (installDialog->_force_depends->isChecked())
76 cmd += " -force-depends "; 76 cmd += " -force-depends ";
77 if (installDialog->_force_reinstall->isChecked()) 77 if (installDialog->_force_reinstall->isChecked())
78 cmd += " -force-reinstall "; 78 cmd += " -force-reinstall ";
79 if (installDialog->_force_remove->isChecked()) 79 if (installDialog->_force_remove->isChecked())
80 cmd += " -force-removal-of-essential-packages "; 80 cmd += " -force-removal-of-essential-packages ";
81 } 81 }
82 82
83 out( "Starting to "+ args+"\n"); 83 out( "Starting to "+ args+"\n");
84 cmd += args; 84 cmd += args;
85 out( "running:\n"+cmd+"\n" ); 85 out( "running:\n"+cmd+"\n" );
86 pvDebug(2,"running:"+cmd); 86 pvDebug(2,"running:"+cmd);
87#ifdef OPROCESS 87#ifdef OPROCESS
88 *ipkgProcess << args; 88 *ipkgProcess << args;
89 out( "running:\n" + cmd); 89 out( "running:\n" + cmd);
90 *ipkgProcess << cmd; 90 *ipkgProcess << cmd;
91 91
92//debug 92//debug
93 ipkgProcess->clearArguments(); 93 ipkgProcess->clearArguments();
94 *ipkgProcess << "/bin/ls "; 94 *ipkgProcess << "/bin/ls ";
95//debug 95//debug
96 QValueList<QCString> a = ipkgProcess->args(); 96 QValueList<QCString> a = ipkgProcess->args();
97 QValueList<QCString>::Iterator it; 97 QValueList<QCString>::Iterator it;
98 for( it = a.begin(); it != a.end(); ++it ) 98 for( it = a.begin(); it != a.end(); ++it )
99 { 99 {
100 out( *it ); 100 out( *it );
101 cmd += *it; 101 cmd += *it;
102 } 102 }
103 103
104 pvDebug(2,"running:"+cmd); 104 pvDebug(2,"running:"+cmd);
105 qApp->processEvents(); 105 qApp->processEvents();
106// sleep(1); 106// sleep(1);
107 ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); 107 ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput);
108 if ( !ret ) { 108 if ( !ret ) {
109 pvDebug(2,"Could not execute '" + cmd); 109 pvDebug(2,"Could not execute '" + cmd);
110 out("\nError while executing "+ cmd+"\n\n"); 110 out("\nError while executing "+ cmd+"\n\n");
111 out("\nError while executing\n\n"); 111 out("\nError while executing\n\n");
112 // return false; 112 // return false;
113 } 113 }
114 114
115 while ( ipkgProcess->isRunning() ) 115 while ( ipkgProcess->isRunning() )
116 { 116 {
117 out("."); 117 out(".");
118 pvDebug(7,"wait for oprocess to terminate"); 118 pvDebug(7,"wait for oprocess to terminate");
119 qApp->processEvents(); 119 qApp->processEvents();
120 }; 120 };
121#else 121#else
122 qApp->processEvents(); 122 qApp->processEvents();
123 FILE *fp; 123 FILE *fp;
124 char line[130]; 124 char line[130];
125 QString lineStr, lineStrOld; 125 QString lineStr, lineStrOld;
126 sleep(1); 126 sleep(1);
127 cmd +=" 2>&1"; 127 cmd +=" 2>&1";
128 fp = popen( (const char *) cmd, "r"); 128 fp = popen( (const char *) cmd, "r");
129 if ( !fp ) { 129 if ( !fp ) {
130 qDebug("Could not execute '" + cmd + "'! err=%d", fp); 130 qDebug("Could not execute '" + cmd + "'! err=%d", fp);
131 pclose(fp); 131 pclose(fp);
132 out("\nError while executing "+ cmd+"\n\n"); 132 out("\nError while executing "+ cmd+"\n\n");
133 return false; 133 return false;
134 } else { 134 } else {
135 while ( fgets( line, sizeof line, fp)) { 135 while ( fgets( line, sizeof line, fp)) {
136 lineStr = line; 136 lineStr = line;
137 lineStr=lineStr.left(lineStr.length()-1); 137 lineStr=lineStr.left(lineStr.length()-1);
138 //Configuring opie-oipkg...Done 138 //Configuring opie-oipkg...Done
139 if (lineStr.contains("Done")) 139 if (lineStr.contains("Done"))
140 ret = true; 140 ret = true;
141 if (lineStr!=lineStrOld) 141 if (lineStr!=lineStrOld)
142 out(lineStr); 142 out(lineStr);
143 lineStrOld = lineStr; 143 lineStrOld = lineStr;
144 qApp->processEvents(); 144 qApp->processEvents();
145 } 145 }
146 pclose(fp); 146 pclose(fp);
147 } 147 }
148#endif 148#endif
149 //out( "Finished!"); 149 //out( "Finished!");
150 pvDebug(2,QString(ret?"success\n":"failure\n")); 150 pvDebug(2,QString(ret?"success\n":"failure\n"));
151 return ret; 151 return ret;
152} 152}
153 153
154void PmIpkg::makeLinks(Package *pack) 154void PmIpkg::makeLinks(Package *pack)
155{ 155{
156 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 156 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
157 linkPackage( pack->name(), pack->dest() ); 157 linkPackage( pack->name(), pack->dest() );
158} 158}
159 159
160QStringList* PmIpkg::getList( QString packFileName, QString d ) 160QStringList* PmIpkg::getList( QString packFileName, QString d )
161{ 161{
162 QString dest = settings->getDestinationUrlByName( d ); 162 QString dest = settings->getDestinationUrlByName( d );
163 dest = dest==""?d:dest; 163 dest = dest==""?d:dest;
164 if (dest == "/" ) return 0; 164 if (dest == "/" ) return 0;
165 { 165 {
166 Config cfg( "oipkg", Config::User ); 166 Config cfg( "oipkg", Config::User );
167 cfg.setGroup( "Common" ); 167 cfg.setGroup( "Common" );
168 QString statusDir = cfg.readEntry( "statusDir", "" ); 168 QString statusDir = cfg.readEntry( "statusDir", "" );
169 } 169 }
170 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; 170 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list";
171 QFile f( packFileName ); 171 QFile f( packFileName );
172 if ( ! f.open(IO_ReadOnly) ) 172 if ( ! f.open(IO_ReadOnly) )
173 { 173 {
174 pvDebug(1," Panik! Could not open"); 174 pvDebug(1," Panik! Could not open");
175 out( "Panik!\n Could not open:\n"+packFileName ); 175 out( "Panik!\n Could not open:\n"+packFileName );
176 return (QStringList*)0; 176 return (QStringList*)0;
177 } 177 }
178 QStringList *fileList = new QStringList(); 178 QStringList *fileList = new QStringList();
179 QTextStream t( &f ); 179 QTextStream t( &f );
180 while ( !t.eof() ) 180 while ( !t.eof() )
181 { 181 {
182 *fileList += t.readLine(); 182 *fileList += t.readLine();
183 } 183 }
184 return fileList; 184 return fileList;
185} 185}
186 186
187void PmIpkg::linkPackage( QString packFileName, QString dest ) 187void PmIpkg::linkPackage( QString packFileName, QString dest )
188{ 188{
189 QStringList *fileList = getList( packFileName, dest ); 189 QStringList *fileList = getList( packFileName, dest );
190 processFileList( fileList, dest ); 190 processFileList( fileList, dest );
191 delete fileList; 191 delete fileList;
192} 192}
193 193
194void PmIpkg::processFileList( QStringList *fileList, QString d ) 194void PmIpkg::processFileList( QStringList *fileList, QString d )
195{ 195{
196 if (!fileList) return; 196 if (!fileList) return;
197 for (uint i=0; i < fileList->count(); i++) 197 for (uint i=0; i < fileList->count(); i++)
198 { 198 {
199 QString dest = settings->getDestinationUrlByName( d ); 199 QString dest = settings->getDestinationUrlByName( d );
200 dest = dest==""?d:dest; 200 dest = dest==""?d:dest;
201 processLinkDir( (*fileList)[i], dest ); 201 processLinkDir( (*fileList)[i], dest );
202 } 202 }
203} 203}
204 204
205 205
206void PmIpkg::processLinkDir( QString file, QString dest ) 206void PmIpkg::processLinkDir( QString file, QString dest )
207{ 207{
208 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); 208 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
209 if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); 209 if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
210 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); 210 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
211 if ( dest == "???" || dest == "" ) return; 211 if ( dest == "???" || dest == "" ) return;
212 QString destFile = file; 212 QString destFile = file;
213 file = dest+"/"+file; 213 file = dest+"/"+file;
214 if (file == dest) return; 214 if (file == dest) return;
215// if (linkOpp==createLink) out( "\ncreating links\n" ); 215// if (linkOpp==createLink) out( "\ncreating links\n" );
216 // if (linkOpp==removeLink) out( "\nremoving links\n" ); 216 // if (linkOpp==removeLink) out( "\nremoving links\n" );
217 QFileInfo fileInfo( file ); 217 QFileInfo fileInfo( file );
218 if ( fileInfo.isDir() ) 218 if ( fileInfo.isDir() )
219 { 219 {
220 pvDebug(4, "process dir "+file); 220 pvDebug(4, "process dir "+file);
221 QDir destDir( destFile ); 221 QDir destDir( destFile );
222 if (linkOpp==createLink) destDir.mkdir( destFile, true ); 222 if (linkOpp==createLink) destDir.mkdir( destFile, true );
223 QDir d( file ); 223 QDir d( file );
224// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 224// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
225 const QFileInfoList *list = d.entryInfoList(); 225 const QFileInfoList *list = d.entryInfoList();
226 QFileInfoListIterator it( *list ); 226 QFileInfoListIterator it( *list );
227 QFileInfo *fi; 227 QFileInfo *fi;
228 while ( (fi=it.current()) ) 228 while ( (fi=it.current()) )
229 { 229 {
230 pvDebug(4, "processLinkDir "+fi->absFilePath()); 230 pvDebug(4, "processLinkDir "+fi->absFilePath());
231 processLinkDir( fi->absFilePath(), dest ); 231 processLinkDir( fi->absFilePath(), dest );
232 ++it; 232 ++it;
233 } 233 }
234 } else 234 } else
235 if ( fileInfo.isFile() ) 235 if ( fileInfo.isFile() )
236 { 236 {
237 const char *instFile = strdup( (file).ascii() ); 237 const char *instFile = strdup( (file).ascii() );
238 const char *linkFile = strdup( (destFile).ascii()); 238 const char *linkFile = strdup( (destFile).ascii());
239 if( linkOpp==createLink ) 239 if( linkOpp==createLink )
240 { 240 {
241 pvDebug(4, "linking: "+file+" -> "+destFile ); 241 pvDebug(4, "linking: "+file+" -> "+destFile );
242 symlink( instFile, linkFile ); 242 symlink( instFile, linkFile );
243 } 243 }
244 } else { 244 } else {
245 const char *linkFile = strdup( (destFile).ascii()); 245 const char *linkFile = strdup( (destFile).ascii());
246 if( linkOpp==removeLink ) 246 if( linkOpp==removeLink )
247 { 247 {
248 QFileInfo toRemoveLink( destFile ); 248 QFileInfo toRemoveLink( destFile );
249 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 249 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
250 { 250 {
251 pvDebug(4,"removing "+destFile+" no "+file); 251 pvDebug(4,"removing "+destFile+" no "+file);
252 unlink( linkFile ); 252 unlink( linkFile );
253 } 253 }
254 } 254 }
255 } 255 }
256} 256}
257 257
258void PmIpkg::loadList( PackageList *pl ) 258void PmIpkg::loadList( PackageList *pl )
259 { 259 {
260 for( Package *pack = pl->first();pack ; (pack = pl->next()) ) 260 for( Package *pack = pl->first();pack ; (pack = pl->next()) )
261 { 261 {
262 if ( pack && (pack->name() != "") && pack) 262 if ( pack && (pack->name() != "") && pack)
263 { 263 {
264 if ( pack->toInstall() ) 264 if ( pack->toInstall() )
265 to_install.append( pack ); 265 to_install.append( pack );
266 if ( pack->toRemove() ) 266 if ( pack->toRemove() )
267 to_remove.append( pack ); 267 to_remove.append( pack );
268 } 268 }
269 } 269 }
270} 270}
271 271
272void PmIpkg::commit() 272void PmIpkg::commit()
273 { 273 {
274 int sizecount = 0; 274 int sizecount = 0;
275 installDialog = new InstallDialog(settings,0,0,true); 275 installDialog = new InstallDialog(settings,0,0,true);
276 installDialog->toRemoveItem->setOpen( true ); 276 installDialog->toRemoveItem->setOpen( true );
277 installDialog->toInstallItem->setOpen( true ); 277 installDialog->toInstallItem->setOpen( true );
278 for (uint i=0; i < to_remove.count(); i++) 278 for (uint i=0; i < to_remove.count(); i++)
279 { 279 {
280 sizecount += 1; 280 sizecount += 1;
281 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); 281 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) );
282 } 282 }
283 for (uint i=0; i < to_install.count(); i++) 283 for (uint i=0; i < to_install.count(); i++)
284 { 284 {
285 sizecount += to_install.at(i)->size().toInt(); 285 sizecount += to_install.at(i)->size().toInt();
286 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); 286 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) );
287 } 287 }
288 runwindow->progress->setTotalSteps(sizecount); 288 runwindow->progress->setTotalSteps(sizecount);
289 qDebug("Install size %i",sizecount); 289 qDebug("Install size %i",sizecount);
290 installDialog->showMaximized(); 290 installDialog->showMaximized();
291 installDialog->show(); 291 installDialog->show();
292 if ( installDialog->exec() ) 292 if ( installDialog->exec() )
293 { 293 {
294 doIt(); 294 doIt();
295 runwindow->showMaximized(); 295 runwindow->showMaximized();
296 runwindow->show(); 296 runwindow->show();
297 } 297 }
298 installDialog->close(); 298 installDialog->close();
299 delete installDialog; 299 delete installDialog;
300 installDialog = 0; 300 installDialog = 0;
301 out(tr("\nAll done.")); 301 out(tr("\nAll done."));
302} 302}
303 303
304void PmIpkg::doIt() 304void PmIpkg::doIt()
305{ 305{
306 runwindow->progress->setProgress(0); 306 runwindow->progress->setProgress(0);
307 show(); 307 show();
308 remove(); 308 remove();
309 install(); 309 install();
310} 310}
311 311
312 312
313void PmIpkg::remove() 313void PmIpkg::remove()
314{ 314{
315 if ( to_remove.count() == 0 ) return; 315 if ( to_remove.count() == 0 ) return;
316 316
317 out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); 317 out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
318 318
319 QStringList *fileList; 319 QStringList *fileList;
320 for (uint i=0; i < to_remove.count(); i++) 320 for (uint i=0; i < to_remove.count(); i++)
321 { 321 {
322 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); 322 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
323 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) 323 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() ))
324 { 324 {
325 runwindow->progress->setProgress( 1 ); 325 runwindow->progress->setProgress( 1 );
326 linkOpp = removeLink; 326 linkOpp = removeLink;
327 to_remove.at(i)->processed(); 327 to_remove.at(i)->processed();
328 pvDebug(3,"link "+QString::number(i)); 328 pvDebug(3,"link "+QString::number(i));
329 if ( to_remove.at(i)->link() ) 329 if ( to_remove.at(i)->link() )
330 processFileList( fileList, to_remove.at(i)->dest() ); 330 processFileList( fileList, to_remove.at(i)->dest() );
331 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); 331 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count()));
332 //if ( to_remove.at(i) ) to_remove.take( i ); 332 //if ( to_remove.at(i) ) to_remove.take( i );
333 333
334 out("\n"); 334 out("\n");
335 }else{ 335 }else{
336 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); 336 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n");
337 if ( to_remove.at(i)->link() ) 337 if ( to_remove.at(i)->link() )
338 processFileList( fileList, to_remove.at(i)->dest() ); 338 processFileList( fileList, to_remove.at(i)->dest() );
339 } 339 }
340 if ( to_remove.at(i)->link() ) 340 if ( to_remove.at(i)->link() )
341 processFileList( fileList, to_remove.at(i)->dest() ); 341 processFileList( fileList, to_remove.at(i)->dest() );
342 if ( to_remove.at(i)->link() )delete fileList; 342 if ( to_remove.at(i)->link() )delete fileList;
343 } 343 }
344 to_remove.clear(); 344 to_remove.clear();
345 out("\n"); 345 out("\n");
346} 346}
347 347
348 348
349void PmIpkg::install() 349void PmIpkg::install()
350{ 350{
351 if ( to_install.count() == 0 ) return; 351 if ( to_install.count() == 0 ) return;
352 out(tr("Installing")+"\n"+tr("please wait")+"\n"); 352 out(tr("Installing")+"\n"+tr("please wait")+"\n");
353 for (uint i=0; i < to_install.count(); i++) 353 for (uint i=0; i < to_install.count(); i++)
354 { 354 {
355 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug 355 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug
356 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) 356 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ))
357 { 357 {
358 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); 358 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
359 to_install.at(i)->processed(); 359 to_install.at(i)->processed();
360 linkOpp = createLink; 360 linkOpp = createLink;
361 if ( to_install.at(i)->link() ) 361 if ( to_install.at(i)->link() )
362 makeLinks( to_install.at(i) ); 362 makeLinks( to_install.at(i) );
363 // to_install.take( i ); 363 // to_install.take( i );
364 out("\n"); 364 out("\n");
365 }else{ 365 }else{
366 out(tr("Error while installing")+to_install.at(i)->name()+"\n"); 366 out(tr("Error while installing")+to_install.at(i)->name()+"\n");
367 linkOpp = createLink; 367 linkOpp = createLink;
368 if ( to_install.at(i)->link() ) 368 if ( to_install.at(i)->link() )
369 makeLinks( to_install.at(i) ); 369 makeLinks( to_install.at(i) );
370 } 370 }
371 } 371 }
372 out("\n"); 372 out("\n");
373 to_install.clear(); 373 to_install.clear();
374} 374}
375 375
376void PmIpkg::createLinks( const QString &dest ) 376void PmIpkg::createLinks( const QString &dest )
377{ 377{
378 pvDebug(2,"PmIpkg::createLinks "+dest); 378 pvDebug(2,"PmIpkg::createLinks "+dest);
379 linkOpp=createLink; 379 linkOpp=createLink;
380 QString url = settings->getDestinationUrlByName( dest ); 380 QString url = settings->getDestinationUrlByName( dest );
381 url = url==""?dest:url; 381 url = url==""?dest:url;
382 processLinkDir( "/opt", url ); 382 processLinkDir( "/opt", url );
383 processLinkDir( "/usr", url ); 383 processLinkDir( "/usr", url );
384} 384}
385 385
386void PmIpkg::removeLinks( const QString &dest ) 386void PmIpkg::removeLinks( const QString &dest )
387{ 387{
388 pvDebug(2,"PmIpkg::removeLinks "+dest); 388 pvDebug(2,"PmIpkg::removeLinks "+dest);
389 linkOpp=removeLink; 389 linkOpp=removeLink;
390 QString url = settings->getDestinationUrlByName( dest ); 390 QString url = settings->getDestinationUrlByName( dest );
391 url = url==""?dest:url; 391 url = url==""?dest:url;
392 processLinkDir( "/opt", url ); 392 processLinkDir( "/opt", url );
393 processLinkDir( "/usr", url ); 393 processLinkDir( "/usr", url );
394} 394}
395 395
396void PmIpkg::update() 396void PmIpkg::update()
397{ 397{
398 show(); 398 show();
399 if ( runIpkg( "update" ) ) 399 if ( runIpkg( "update" ) )
400 runwindow->close(); 400 runwindow->close();
401 else out("An error occurred!\nPlease check the log."); 401 else out("An error occurred!\nPlease check the log.");
402} 402}
403 403
404void PmIpkg::out( QString o ) 404void PmIpkg::out( QString o )
405{ 405{
406 runwindow->outPut->append(o); 406 runwindow->outPut->append(o);
407 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); 407 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE);
408} 408}
409 409
410 410
411 411
412 412
413void PmIpkg::show() 413void PmIpkg::show()
414{ 414{
415 if (!runwindow->isVisible()) 415 if (!runwindow->isVisible())
416 { 416 {
417 runwindow->showMaximized(); 417 runwindow->showMaximized();
418 runwindow->show(); 418 runwindow->show();
419 } 419 }
420 runwindow->outPut->setText(""); 420 runwindow->outPut->setText("");
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 commit(); 432 commit();
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 commit(); 445 commit();
446 delete p; 446 delete p;
447} 447}
448 448
449 449
450void PmIpkg::clearLists() 450void PmIpkg::clearLists()
451{ 451{
452 to_remove.clear(); 452 to_remove.clear();
453 to_install.clear(); 453 to_install.clear();
454} 454}
455 455
456 456
457void PmIpkg::getIpkgOutput(OProcess *proc, char *buffer, int buflen) 457void PmIpkg::getIpkgOutput(OProcess *proc, char *buffer, int buflen)
458{ 458{
459 QString lineStr, lineStrOld; 459 QString lineStr, lineStrOld;
460 lineStr = buffer; 460 lineStr = buffer;
461 lineStr=lineStr.left(buflen); 461 lineStr=lineStr.left(buflen);
462 //Configuring opie-oipkg...Done 462 //Configuring opie-oipkg...Done
463 if (lineStr!=lineStrOld) 463 if (lineStr!=lineStrOld)
464 out(lineStr); 464 out(lineStr);
465 lineStrOld = lineStr; 465 lineStrOld = lineStr;
466} \ No newline at end of file 466}
diff --git a/noncore/unsupported/oipkg/utils.cpp b/noncore/unsupported/oipkg/utils.cpp
index 13b17fb..66dcf10 100644
--- a/noncore/unsupported/oipkg/utils.cpp
+++ b/noncore/unsupported/oipkg/utils.cpp
@@ -1,27 +1,27 @@
1/*************************************************************************** 1/***************************************************************************
2 utils.cpp - description 2 utils.cpp - description
3 ------------------- 3 -------------------
4 begin : Sun Apr 28 2002 4 begin : Sun Apr 28 2002
5 copyright : (C) 2002 by tille 5 copyright : (C) 2002 by tille
6 email : tille@handhelds.org 6 email : tille@handhelds.org
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <qcombobox.h> 18#include <qcombobox.h>
19#include <qstring.h> 19#include <qstring.h>
20#include "utils.h" 20#include "utils.h"
21 21
22void setComboName( QComboBox* combo, QString s) 22void setComboName( QComboBox* combo, QString s)
23{ 23{
24 for ( int i = 0; i < combo->count(); i++) 24 for ( int i = 0; i < combo->count(); i++)
25 if ( combo->text( i ) == s ) 25 if ( combo->text( i ) == s )
26 combo->setCurrentItem( i ); 26 combo->setCurrentItem( i );
27} \ No newline at end of file 27}
diff --git a/noncore/unsupported/oipkg/utils.h b/noncore/unsupported/oipkg/utils.h
index bb033c5..ecc70dc 100644
--- a/noncore/unsupported/oipkg/utils.h
+++ b/noncore/unsupported/oipkg/utils.h
@@ -1,18 +1,18 @@
1/*************************************************************************** 1/***************************************************************************
2 utils.h - description 2 utils.h - description
3 ------------------- 3 -------------------
4 begin : Sun Apr 28 2002 4 begin : Sun Apr 28 2002
5 copyright : (C) 2002 by tille 5 copyright : (C) 2002 by tille
6 email : tille@handhelds.org 6 email : tille@handhelds.org
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18void setComboName( QComboBox*, QString ); \ No newline at end of file 18void setComboName( QComboBox*, QString );