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