author | tille <tille> | 2002-07-01 13:31:20 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-01 13:31:20 (UTC) |
commit | 1f42fc6dd4ef09b5a9526e81784ab3d05b9300b1 (patch) (unidiff) | |
tree | eaf5284b3841c247c9f048e6c529053ca9ded412 | |
parent | 346ea8fa0d904e940659bc35fad0fc0da8cc7f80 (diff) | |
download | opie-1f42fc6dd4ef09b5a9526e81784ab3d05b9300b1.zip opie-1f42fc6dd4ef09b5a9526e81784ab3d05b9300b1.tar.gz opie-1f42fc6dd4ef09b5a9526e81784ab3d05b9300b1.tar.bz2 |
cosmetics
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 35 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 21 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/utils.cpp | 9 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/utils.h | 9 |
4 files changed, 37 insertions, 37 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 084900d..53db477 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,361 +1,364 @@ | |||
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"), &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 | pvDebug(0,"no UPDATE of DocLnk"); | ||
65 | packageListDocLnk.update(); | 64 | packageListDocLnk.update(); |
66 | pvDebug(9,"makeMenu"); | 65 | pvDebug(9,"makeMenu"); |
67 | makeMenu(); | 66 | makeMenu(); |
68 | makeChannel(); | 67 | makeChannel(); |
69 | //opie is hardcoded default ;) | 68 | |
70 | //pvDebug(9,"section->setCurrentItem"); | ||
71 | // for (int i=0;i<section->count();i++) | ||
72 | // if (section->text(i)=="opie") | ||
73 | // section->setCurrentItem(i); | ||
74 | // sectionChanged(); | ||
75 | 69 | ||
76 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 70 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
77 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 71 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
78 | 72 | ||
79 | connect( settings->removeLinksButton, SIGNAL( clicked()), | 73 | connect( settings->removeLinksButton, SIGNAL( clicked()), |
80 | SLOT(removeLinks()) ); | 74 | SLOT(removeLinks()) ); |
81 | connect( settings->createLinksButton, SIGNAL( clicked()), | 75 | connect( settings->createLinksButton, SIGNAL( clicked()), |
82 | SLOT(createLinks()) ); | 76 | SLOT(createLinks()) ); |
83 | 77 | ||
84 | pvDebug(9,"displayList"); | 78 | pvDebug(9,"displayList"); |
85 | displayList(); | 79 | displayList(); |
86 | } | 80 | } |
87 | 81 | ||
88 | void MainWindow::makeMenu() | 82 | void MainWindow::makeMenu() |
89 | { | 83 | { |
90 | 84 | ||
91 | QPEToolBar *toolBar = new QPEToolBar( this ); | 85 | QPEToolBar *toolBar = new QPEToolBar( this ); |
92 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 86 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
93 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 87 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
94 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 88 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
95 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 89 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
96 | QPopupMenu *helpMenu = new QPopupMenu( menuBar ); | 90 | QPopupMenu *helpMenu = new QPopupMenu( menuBar ); |
97 | 91 | ||
98 | setToolBarsMovable( false ); | 92 | setToolBarsMovable( false ); |
99 | toolBar->setHorizontalStretchable( true ); | 93 | toolBar->setHorizontalStretchable( true ); |
100 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 94 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
101 | menuBar->insertItem( tr( "View" ), viewMenu ); | 95 | menuBar->insertItem( tr( "View" ), viewMenu ); |
102 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 96 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
103 | menuBar->insertItem( tr( "Help" ), helpMenu ); | 97 | menuBar->insertItem( tr( "Help" ), helpMenu ); |
104 | 98 | ||
105 | QLabel *spacer; | 99 | QLabel *spacer; |
106 | // spacer = new QLabel( "", toolBar ); | 100 | // spacer = new QLabel( "", toolBar ); |
107 | // spacer->setBackgroundColor( toolBar->backgroundColor() ); | 101 | // spacer->setBackgroundColor( toolBar->backgroundColor() ); |
108 | // toolBar->setStretchableWidget( spacer ); | 102 | // toolBar->setStretchableWidget( spacer ); |
109 | 103 | ||
110 | 104 | ||
111 | runAction = new QAction( tr( "Apply" ), | 105 | runAction = new QAction( tr( "Apply" ), |
112 | Resource::loadPixmap( "oipkg/install" ), | 106 | Resource::loadPixmap( "oipkg/install" ), |
113 | QString::null, 0, this, 0 ); | 107 | QString::null, 0, this, 0 ); |
114 | connect( runAction, SIGNAL( activated() ), | 108 | connect( runAction, SIGNAL( activated() ), |
115 | this, SLOT( runIpkg() ) ); | 109 | this, SLOT( runIpkg() ) ); |
116 | runAction->addTo( toolBar ); | 110 | runAction->addTo( toolBar ); |
117 | runAction->addTo( srvMenu ); | 111 | runAction->addTo( srvMenu ); |
118 | 112 | ||
119 | srvMenu->insertSeparator(); | 113 | srvMenu->insertSeparator(); |
120 | 114 | ||
121 | updateAction = new QAction( tr( "Update" ), | 115 | updateAction = new QAction( tr( "Update" ), |
122 | Resource::loadIconSet( "oipkg/update" ), | 116 | Resource::loadIconSet( "oipkg/update" ), |
123 | QString::null, 0, this, 0 ); | 117 | QString::null, 0, this, 0 ); |
124 | connect( updateAction, SIGNAL( activated() ), | 118 | connect( updateAction, SIGNAL( activated() ), |
125 | this , SLOT( updateList() ) ); | 119 | this , SLOT( updateList() ) ); |
126 | updateAction->addTo( toolBar ); | 120 | updateAction->addTo( toolBar ); |
127 | updateAction->addTo( srvMenu ); | 121 | updateAction->addTo( srvMenu ); |
128 | 122 | ||
129 | QAction *cfgact; | 123 | QAction *cfgact; |
130 | 124 | ||
131 | cfgact = new QAction( tr( "Setups" ), | 125 | cfgact = new QAction( tr( "Setups" ), |
132 | QString::null, 0, this, 0 ); | 126 | QString::null, 0, this, 0 ); |
133 | connect( cfgact, SIGNAL( activated() ), | 127 | connect( cfgact, SIGNAL( activated() ), |
134 | SLOT( showSettings() ) ); | 128 | SLOT( showSettings() ) ); |
135 | cfgact->addTo( cfgMenu ); | 129 | cfgact->addTo( cfgMenu ); |
136 | 130 | ||
137 | cfgact = new QAction( tr( "Servers" ), | 131 | cfgact = new QAction( tr( "Servers" ), |
138 | QString::null, 0, this, 0 ); | 132 | QString::null, 0, this, 0 ); |
139 | connect( cfgact, SIGNAL( activated() ), | 133 | connect( cfgact, SIGNAL( activated() ), |
140 | SLOT( showSettingsSrv() ) ); | 134 | SLOT( showSettingsSrv() ) ); |
141 | cfgact->addTo( cfgMenu ); | 135 | cfgact->addTo( cfgMenu ); |
142 | cfgact = new QAction( tr( "Destinations" ), | 136 | cfgact = new QAction( tr( "Destinations" ), |
143 | QString::null, 0, this, 0 ); | 137 | QString::null, 0, this, 0 ); |
144 | connect( cfgact, SIGNAL( activated() ), | 138 | connect( cfgact, SIGNAL( activated() ), |
145 | SLOT( showSettingsDst() ) ); | 139 | SLOT( showSettingsDst() ) ); |
146 | cfgact->addTo( cfgMenu ); | 140 | cfgact->addTo( cfgMenu ); |
147 | 141 | ||
148 | QAction *a; | 142 | QAction *a; |
149 | 143 | ||
150 | // SECTIONS | 144 | // SECTIONS |
151 | sectionBar = new QPEToolBar( this ); | 145 | sectionBar = new QPEToolBar( this ); |
152 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 146 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
153 | sectionBar->setHorizontalStretchable( true ); | 147 | sectionBar->setHorizontalStretchable( true ); |
154 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 148 | QLabel *label = new QLabel( sectionBar, "section" ); |
155 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 149 | // label->setBackgroundMode( NoBackground ); |
150 | label->font().setPointSize( 8 ); | ||
151 | label->setText( tr( "Section:" ) ); | ||
152 | sectionBar->setStretchableWidget( label ); | ||
156 | section = new QComboBox( false, sectionBar ); | 153 | section = new QComboBox( false, sectionBar ); |
154 | section->font().setPointSize( 8 ); | ||
157 | label = new QLabel( " / ", sectionBar ); | 155 | label = new QLabel( " / ", sectionBar ); |
158 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 156 | label->font().setPointSize( 8 ); |
157 | // label->setBackgroundMode( PaletteForeground ); | ||
159 | subsection = new QComboBox( false, sectionBar ); | 158 | subsection = new QComboBox( false, sectionBar ); |
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->setBackgroundColor( findBar->backgroundColor() ); | 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("ipkgfind: "), searchBar ); |
196 | label->setBackgroundColor( searchBar->backgroundColor() ); | 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->setBackgroundColor( destBar->backgroundColor() ); | 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->setBackgroundColor( destBar->backgroundColor() ); | 228 | // spacer->setBackgroundMode( PaletteForeground ); |
229 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 229 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
230 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 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")); | ||
289 | sectionChanged(); | ||
288 | } | 290 | } |
289 | 291 | ||
290 | MainWindow::~MainWindow() | 292 | MainWindow::~MainWindow() |
291 | { | 293 | { |
292 | Config cfg( "oipkg", Config::User ); | 294 | Config cfg( "oipkg", Config::User ); |
293 | cfg.setGroup( "gui" ); | 295 | cfg.setGroup( "gui" ); |
294 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 296 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
295 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 297 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
296 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 298 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
297 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 299 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
300 | cfg.writeEntry( "default_section", section->currentText() ); | ||
298 | 301 | ||
299 | } | 302 | } |
300 | 303 | ||
301 | void MainWindow::runIpkg() | 304 | void MainWindow::runIpkg() |
302 | { | 305 | { |
303 | packageListServers.allPackages(); | 306 | packageListServers.allPackages(); |
304 | ipkg->loadList( &packageListSearch ); | 307 | ipkg->loadList( &packageListSearch ); |
305 | ipkg->loadList( &packageListDocLnk ); | 308 | ipkg->loadList( &packageListDocLnk ); |
306 | ipkg->loadList( &packageListServers ); | 309 | ipkg->loadList( &packageListServers ); |
307 | ipkg->commit(); | 310 | ipkg->commit(); |
308 | ipkg->clearLists(); | 311 | ipkg->clearLists(); |
309 | // ##### 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 |
310 | // ##### 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". |
311 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 314 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
312 | QString lf = QString::null; | 315 | QString lf = QString::null; |
313 | e << lf; | 316 | e << lf; |
314 | displayList(); | 317 | displayList(); |
315 | } | 318 | } |
316 | 319 | ||
317 | void MainWindow::updateList() | 320 | void MainWindow::updateList() |
318 | { | 321 | { |
319 | packageListServers.clear(); | 322 | packageListServers.clear(); |
320 | packageListSearch.clear(); | 323 | packageListSearch.clear(); |
321 | 324 | ||
322 | packageListDocLnk.clear(); | 325 | packageListDocLnk.clear(); |
323 | ipkg->update(); | 326 | ipkg->update(); |
324 | packageListServers.update(); | 327 | packageListServers.update(); |
325 | packageListSearch.update(); | 328 | packageListSearch.update(); |
326 | packageListDocLnk.update(); | 329 | packageListDocLnk.update(); |
327 | } | 330 | } |
328 | 331 | ||
329 | void MainWindow::filterList() | 332 | void MainWindow::filterList() |
330 | { | 333 | { |
331 | QString f = ""; | 334 | QString f = ""; |
332 | if ( findAction->isOn() ) f = findEdit->text(); | 335 | if ( findAction->isOn() ) f = findEdit->text(); |
333 | packageListServers.filterPackages( f ); | 336 | packageListServers.filterPackages( f ); |
334 | } | 337 | } |
335 | 338 | ||
336 | void MainWindow::displayList() | 339 | void MainWindow::displayList() |
337 | { | 340 | { |
338 | filterList(); | 341 | filterList(); |
339 | listViewPackages->display(); | 342 | listViewPackages->display(); |
340 | } | 343 | } |
341 | 344 | ||
342 | void MainWindow::sectionChanged() | 345 | void MainWindow::sectionChanged() |
343 | { | 346 | { |
344 | disconnect( section, SIGNAL( activated(int) ), | 347 | disconnect( section, SIGNAL( activated(int) ), |
345 | this, SLOT( sectionChanged() ) ); | 348 | this, SLOT( sectionChanged() ) ); |
346 | disconnect( subsection, SIGNAL(activated(int) ), | 349 | disconnect( subsection, SIGNAL(activated(int) ), |
347 | this, SLOT( subSectionChanged() ) ); | 350 | this, SLOT( subSectionChanged() ) ); |
348 | subsection->clear(); | 351 | subsection->clear(); |
349 | packageListServers.setSection( section->currentText() ); | 352 | packageListServers.setSection( section->currentText() ); |
350 | setSubSections(); | 353 | setSubSections(); |
351 | connect( section, SIGNAL( activated(int) ), | 354 | connect( section, SIGNAL( activated(int) ), |
352 | this, SLOT( sectionChanged() ) ); | 355 | this, SLOT( sectionChanged() ) ); |
353 | connect( subsection, SIGNAL(activated(int) ), | 356 | connect( subsection, SIGNAL(activated(int) ), |
354 | this, SLOT( subSectionChanged() ) ); | 357 | this, SLOT( subSectionChanged() ) ); |
355 | displayList(); | 358 | displayList(); |
356 | } | 359 | } |
357 | 360 | ||
358 | void MainWindow::subSectionChanged() | 361 | void MainWindow::subSectionChanged() |
359 | { | 362 | { |
360 | disconnect( section, SIGNAL( activated(int) ), | 363 | disconnect( section, SIGNAL( activated(int) ), |
361 | this, SLOT( sectionChanged() ) ); | 364 | this, SLOT( sectionChanged() ) ); |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index de1f162..4a8a389 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -6,256 +6,267 @@ | |||
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 | ||
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 ) |
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->clearArguments(); | 71 | ipkgProcess->clearArguments(); |
71 | *ipkgProcess << "/usr/bin/ipkg "; | 72 | *ipkgProcess << "/usr/bin/ipkg "; |
72 | cmd = ""; | 73 | cmd = ""; |
73 | #endif | 74 | #endif |
74 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 75 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
75 | if ( dest == "" ) | 76 | if ( dest == "" ) |
76 | cmd += " -dest "+settings->getDestinationName(); | 77 | cmd += " -dest "+settings->getDestinationName(); |
77 | else | 78 | else |
78 | cmd += " -dest "+ dest; | 79 | cmd += " -dest "+ dest; |
79 | 80 | ||
80 | cmd += " -force-defaults "; | 81 | cmd += " -force-defaults "; |
81 | 82 | ||
82 | if (installDialog && installDialog->_force_depends) | 83 | if (installDialog && installDialog->_force_depends) |
83 | { | 84 | { |
84 | if (installDialog->_force_depends->isChecked()) | 85 | if (installDialog->_force_depends->isChecked()) |
85 | cmd += " -force-depends "; | 86 | cmd += " -force-depends "; |
86 | if (installDialog->_force_reinstall->isChecked()) | 87 | if (installDialog->_force_reinstall->isChecked()) |
87 | cmd += " -force-reinstall "; | 88 | cmd += " -force-reinstall "; |
88 | if (installDialog->_force_remove->isChecked()) | 89 | if (installDialog->_force_remove->isChecked()) |
89 | cmd += " -force-removal-of-essential-packages "; | 90 | cmd += " -force-removal-of-essential-packages "; |
90 | } | 91 | } |
91 | 92 | ||
92 | out( "Starting to "+ args+"\n"); | 93 | out( "Starting to "+ args+"\n"); |
93 | cmd += args; | 94 | cmd += args; |
94 | out( "running:\n"+cmd+"\n" ); | 95 | out( "running:\n"+cmd+"\n" ); |
95 | pvDebug(2,"running:"+cmd); | 96 | pvDebug(2,"running:"+cmd); |
96 | #ifdef OPROCESS | 97 | #ifdef OPROCESS |
97 | *ipkgProcess << args; | 98 | *ipkgProcess << args; |
98 | out( "running:\n" + cmd); | 99 | out( "running:\n" + cmd); |
99 | *ipkgProcess << cmd; | 100 | *ipkgProcess << cmd; |
100 | 101 | ||
101 | //debug | 102 | //debug |
103 | delete ipkgProcess; | ||
104 | ipkgProcess = new OProcess(); | ||
102 | ipkgProcess->clearArguments(); | 105 | ipkgProcess->clearArguments(); |
103 | *ipkgProcess << "/bin/ls "; | 106 | *ipkgProcess << "/bin/ls "; |
104 | //debug | 107 | //debug |
105 | QValueList<QCString> a = ipkgProcess->args(); | 108 | QValueList<QCString> a = ipkgProcess->args(); |
106 | QValueList<QCString>::Iterator it; | 109 | QValueList<QCString>::Iterator it; |
107 | for( it = a.begin(); it != a.end(); ++it ) | 110 | for( it = a.begin(); it != a.end(); ++it ) |
108 | { | 111 | { |
109 | out( *it ); | 112 | out( *it ); |
110 | cmd += *it; | 113 | cmd += *it; |
111 | } | 114 | } |
112 | 115 | ||
113 | pvDebug(2,"running:"+cmd); | 116 | pvDebug(2,"running:"+cmd); |
114 | qApp->processEvents(); | 117 | qApp->processEvents(); |
115 | // sleep(1); | 118 | // sleep(1); |
116 | ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); | 119 | ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); |
117 | if ( !ret ) { | 120 | if ( !ret ) { |
118 | pvDebug(2,"Could not execute '" + cmd); | 121 | pvDebug(2,"Could not execute '" + cmd); |
119 | out("\nError while executing "+ cmd+"\n\n"); | 122 | out("\nError while executing "+ cmd+"\n\n"); |
120 | out("\nError while executing\n\n"); | 123 | out("\nError while executing\n\n"); |
121 | // return false; | 124 | // return false; |
122 | } | 125 | } |
123 | 126 | ||
124 | while ( ipkgProcess->isRunning() ) | 127 | while ( ipkgProcess->isRunning() ) |
125 | { | 128 | { |
126 | out("."); | 129 | out("."); |
127 | pvDebug(7,"wait for oprocess to terminate"); | 130 | pvDebug(7,"wait for oprocess to terminate"); |
128 | qApp->processEvents(); | 131 | qApp->processEvents(); |
129 | }; | 132 | }; |
130 | #else | 133 | #else |
131 | qApp->processEvents(); | 134 | qApp->processEvents(); |
132 | FILE *fp; | 135 | FILE *fp; |
133 | char line[130]; | 136 | char line[130]; |
134 | QString lineStr, lineStrOld; | 137 | QString lineStr, lineStrOld; |
135 | sleep(1); | 138 | sleep(1); |
136 | cmd +=" 2>&1"; | 139 | cmd +=" 2>&1"; |
137 | fp = popen( (const char *) cmd, "r"); | 140 | fp = popen( (const char *) cmd, "r"); |
138 | if ( fp == NULL ) { | 141 | if ( fp == NULL ) { |
139 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 142 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
140 | out("\nError while executing "+ cmd+"\n\n"); | 143 | out("\nError while executing "+ cmd+"\n\n"); |
141 | ret = false; | 144 | ret = false; |
142 | } else { | 145 | } else { |
143 | while ( fgets( line, sizeof line, fp) != NULL) | 146 | while ( fgets( line, sizeof line, fp) != NULL) |
144 | { | 147 | { |
145 | lineStr = line; | 148 | lineStr = line; |
146 | lineStr=lineStr.left(lineStr.length()-1); | 149 | lineStr=lineStr.left(lineStr.length()-1); |
147 | //Configuring opie-oipkg...Done | 150 | //Configuring opie-oipkg...Done |
148 | if (lineStr.contains("Done")) ret = true; | 151 | if (lineStr.contains("Done")) ret = true; |
149 | if (lineStr!=lineStrOld) | 152 | if (lineStr!=lineStrOld) |
150 | out(lineStr); | 153 | out(lineStr); |
151 | lineStrOld = lineStr; | 154 | lineStrOld = lineStr; |
152 | qApp->processEvents(); | 155 | qApp->processEvents(); |
153 | } | 156 | } |
154 | } | 157 | } |
155 | pclose(fp); | 158 | pclose(fp); |
156 | #endif | 159 | #endif |
157 | //out( "Finished!"); | 160 | //out( "Finished!"); |
158 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 161 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
159 | return ret; | 162 | return ret; |
160 | } | 163 | } |
161 | 164 | ||
162 | void PmIpkg::makeLinks(Package *pack) | 165 | void PmIpkg::makeLinks(Package *pack) |
163 | { | 166 | { |
164 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 167 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
165 | QString pn = pack->name(); | 168 | QString pn = pack->name(); |
166 | linkPackage( pack->packageName(), pack->dest() ); | 169 | linkPackage( pack->packageName(), pack->dest() ); |
167 | } | 170 | } |
168 | 171 | ||
169 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 172 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
170 | { | 173 | { |
171 | QString dest = settings->getDestinationUrlByName( d ); | 174 | QString dest = settings->getDestinationUrlByName( d ); |
172 | dest = dest==""?d:dest; | 175 | dest = dest==""?d:dest; |
173 | if (dest == "/" ) return 0; | 176 | // if (dest == "/" ) return 0; |
174 | { | 177 | { |
175 | Config cfg( "oipkg", Config::User ); | 178 | Config cfg( "oipkg", Config::User ); |
176 | cfg.setGroup( "Common" ); | 179 | cfg.setGroup( "Common" ); |
177 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 180 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
178 | } | 181 | } |
179 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 182 | QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
180 | QFile f( packFileName ); | 183 | QFile f( packFileName ); |
181 | if ( ! f.open(IO_ReadOnly) ) | 184 | if ( ! f.open(IO_ReadOnly) ) |
182 | { | 185 | { |
183 | pvDebug(1," Panik! Could not open"); | 186 | out( "Could not open:\n"+packFileDir ); |
184 | out( "Panik!\n Could not open:\n"+packFileName ); | 187 | f.close(); |
185 | return (QStringList*)0; | 188 | packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; |
189 | f.setName( packFileDir ); | ||
190 | if ( ! f.open(IO_ReadOnly) ) | ||
191 | { | ||
192 | qDebug(" Panik! Could not open"+packFileDir); | ||
193 | out( "Could not open:\n"+packFileDir+"\n Panik!" ); | ||
194 | } | ||
186 | } | 195 | } |
187 | QStringList *fileList = new QStringList(); | 196 | QStringList *fileList = new QStringList(); |
188 | QTextStream t( &f ); | 197 | QTextStream t( &f ); |
189 | while ( !t.eof() ) | 198 | while ( !t.eof() ) |
190 | { | 199 | { |
191 | *fileList += t.readLine(); | 200 | *fileList += t.readLine(); |
192 | } | 201 | } |
202 | f.close(); | ||
193 | return fileList; | 203 | return fileList; |
194 | } | 204 | } |
195 | 205 | ||
196 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 206 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
197 | { | 207 | { |
208 | if (dest == "root" || dest == "/" ) return; | ||
198 | QStringList *fileList = getList( packFileName, dest ); | 209 | QStringList *fileList = getList( packFileName, dest ); |
199 | processFileList( fileList, dest ); | 210 | processFileList( fileList, dest ); |
200 | delete fileList; | 211 | delete fileList; |
201 | } | 212 | } |
202 | 213 | ||
203 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 214 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
204 | { | 215 | { |
205 | if (!fileList) return; | 216 | if (!fileList) return; |
206 | for (uint i=0; i < fileList->count(); i++) | 217 | for (uint i=0; i < fileList->count(); i++) |
207 | { | 218 | { |
208 | QString dest = settings->getDestinationUrlByName( d ); | 219 | QString dest = settings->getDestinationUrlByName( d ); |
209 | dest = dest==""?d:dest; | 220 | dest = dest==""?d:dest; |
210 | processLinkDir( (*fileList)[i], dest ); | 221 | processLinkDir( (*fileList)[i], dest ); |
211 | } | 222 | } |
212 | } | 223 | } |
213 | 224 | ||
214 | 225 | ||
215 | void PmIpkg::processLinkDir( QString file, QString dest ) | 226 | void PmIpkg::processLinkDir( QString file, QString dest ) |
216 | { | 227 | { |
217 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 228 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
218 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 229 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
219 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 230 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
220 | if ( dest == "???" || dest == "" ) return; | 231 | if ( dest == "???" || dest == "" ) return; |
221 | QString destFile = file; | 232 | QString destFile = file; |
222 | file = dest+"/"+file; | 233 | file = dest+"/"+file; |
223 | if (file == dest) return; | 234 | if (file == dest) return; |
224 | // if (linkOpp==createLink) out( "\ncreating links\n" ); | 235 | // if (linkOpp==createLink) out( "\ncreating links\n" ); |
225 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); | 236 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); |
226 | QFileInfo fileInfo( file ); | 237 | QFileInfo fileInfo( file ); |
227 | if ( fileInfo.isDir() ) | 238 | if ( fileInfo.isDir() ) |
228 | { | 239 | { |
229 | pvDebug(4, "process dir "+file); | 240 | pvDebug(4, "process dir "+file); |
230 | QDir destDir( destFile ); | 241 | QDir destDir( destFile ); |
231 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 242 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
232 | QDir d( file ); | 243 | QDir d( file ); |
233 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 244 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
234 | const QFileInfoList *list = d.entryInfoList(); | 245 | const QFileInfoList *list = d.entryInfoList(); |
235 | QFileInfoListIterator it( *list ); | 246 | QFileInfoListIterator it( *list ); |
236 | QFileInfo *fi; | 247 | QFileInfo *fi; |
237 | while ( (fi=it.current()) ) | 248 | while ( (fi=it.current()) ) |
238 | { | 249 | { |
239 | pvDebug(4, "processLinkDir "+fi->absFilePath()); | 250 | pvDebug(4, "processLinkDir "+fi->absFilePath()); |
240 | processLinkDir( fi->absFilePath(), dest ); | 251 | processLinkDir( fi->absFilePath(), dest ); |
241 | ++it; | 252 | ++it; |
242 | } | 253 | } |
243 | } else | 254 | } else |
244 | if ( fileInfo.isFile() ) | 255 | if ( fileInfo.isFile() ) |
245 | { | 256 | { |
246 | const char *instFile = strdup( (file).latin1() ); | 257 | const char *instFile = strdup( (file).latin1() ); |
247 | const char *linkFile = strdup( (destFile).latin1()); | 258 | const char *linkFile = strdup( (destFile).latin1()); |
248 | if( linkOpp==createLink ) | 259 | if( linkOpp==createLink ) |
249 | { | 260 | { |
250 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 261 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
251 | symlink( instFile, linkFile ); | 262 | symlink( instFile, linkFile ); |
252 | } | 263 | } |
253 | } else { | 264 | } else { |
254 | const char *linkFile = strdup( (destFile).latin1()); | 265 | const char *linkFile = strdup( (destFile).latin1()); |
255 | if( linkOpp==removeLink ) | 266 | if( linkOpp==removeLink ) |
256 | { | 267 | { |
257 | QFileInfo toRemoveLink( destFile ); | 268 | QFileInfo toRemoveLink( destFile ); |
258 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 269 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
259 | { | 270 | { |
260 | pvDebug(4,"removing "+destFile+" no "+file); | 271 | pvDebug(4,"removing "+destFile+" no "+file); |
261 | unlink( linkFile ); | 272 | unlink( linkFile ); |
diff --git a/noncore/unsupported/oipkg/utils.cpp b/noncore/unsupported/oipkg/utils.cpp index 66dcf10..6821343 100644 --- a/noncore/unsupported/oipkg/utils.cpp +++ b/noncore/unsupported/oipkg/utils.cpp | |||
@@ -1,27 +1,20 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | utils.cpp - description | ||
3 | ------------------- | ||
4 | begin : Sun Apr 28 2002 | ||
5 | copyright : (C) 2002 by tille | ||
6 | email : tille@handhelds.org | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | 2 | * * |
11 | * 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 * |
12 | * 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 * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
15 | * * | 7 | * * |
16 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
17 | 10 | ||
18 | #include <qcombobox.h> | 11 | #include <qcombobox.h> |
19 | #include <qstring.h> | 12 | #include <qstring.h> |
20 | #include "utils.h" | 13 | #include "utils.h" |
21 | 14 | ||
22 | void setComboName( QComboBox* combo, QString s) | 15 | void setComboName( QComboBox* combo, QString s) |
23 | { | 16 | { |
24 | for ( int i = 0; i < combo->count(); i++) | 17 | for ( int i = 0; i < combo->count(); i++) |
25 | if ( combo->text( i ) == s ) | 18 | if ( combo->text( i ) == s ) |
26 | combo->setCurrentItem( i ); | 19 | combo->setCurrentItem( i ); |
27 | } | 20 | } |
diff --git a/noncore/unsupported/oipkg/utils.h b/noncore/unsupported/oipkg/utils.h index ecc70dc..da33eda 100644 --- a/noncore/unsupported/oipkg/utils.h +++ b/noncore/unsupported/oipkg/utils.h | |||
@@ -1,18 +1,11 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | utils.h - description | ||
3 | ------------------- | ||
4 | begin : Sun Apr 28 2002 | ||
5 | copyright : (C) 2002 by tille | ||
6 | email : tille@handhelds.org | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | 2 | * * |
11 | * 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 * |
12 | * 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 * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
15 | * * | 7 | * * |
16 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
17 | 10 | ||
18 | void setComboName( QComboBox*, QString ); | 11 | void setComboName( QComboBox*, QString ); |