-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 | |||
@@ -7,97 +7,97 @@ | |||
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 | ||
@@ -147,97 +147,97 @@ void MainWindow::makeMenu() | |||
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 |
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,90 +1,90 @@ | |||
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 "; |
@@ -111,96 +111,102 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
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; |
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 |